Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

211
Vistas
How do I use twitter-text in a browser

I want to count tweet length. Twitter makes this very very hard.

They have this repo: https://github.com/twitter/twitter-text which contains this folder: https://github.com/twitter/twitter-text/tree/master/js which supposedly supports javascript.

When I try to use the script from a cdn like this: https://www.jsdelivr.com/package/npm/twitter-text

it says require is not defined

I don't understand what I'm supposed to do. Why is it using require if it's for javascript?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

  1. Install Browserify
  2. Download the latest twitter-text script from this folder: https://github.com/twitter/twitter-text/tree/master/js/pkg
  3. Create index.js with the contents: window.twitter = require('./twitter-text-3.1.0.min.js');
  4. Run browserify index.js -o twitter-text-js.js

The output file can now be run in browser and accessed with the global twitter.

(or just download the prepackaged version here: https://gist.github.com/skeddles/3841236279efebf053dfa39dfdbae2c2#file-twitter-text-js-js)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda