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?
index.js
with the contents: window.twitter = require('./twitter-text-3.1.0.min.js');
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)