uglify-js on the command line without first installing any teels, using npx (which downloads and executes a CLI tool while skipping the install step):
npx uglify-js codemirror-5.57.0.js -o codemirror-5.57.0.min.js
One problem: this stripped out the LICENSE comment at the top of the file.
Turns out you can tell
uglify-js not to strip comments that match a specific regular expression.
So I edited the CodeMirror file to use a single
/* ... */ comment at the top of the file (instead of multiple
// lines) and ran Uglify like this:
npx uglify-js codemirror-5.57.0.js -o codemirror-5.57.0.min.js --comments '/LICENSE/'
For CSS I used
npx clean-css-cli codemirror-5.57.0.css -o codemirror-5.57.0.min.css
It turns out
uglify-js doesn't support ES6 at all. You can use tercer instead:
npx terser codemirror-5.57.0.js -o codemirror-5.57.0.min.js --comments '/LICENSE/'
Discovered in datasette-edit-tables #16.
Created 2020-08-30T11:20:43-07:00, updated 2021-01-24T11:58:15-08:00 · History · Edit