Skip to content

Instantly share code, notes, and snippets.

@abradley2
Created May 8, 2021 11:09
Show Gist options
  • Save abradley2/332f714b6ad2464e9ac30abcc38cb84b to your computer and use it in GitHub Desktop.
Save abradley2/332f714b6ad2464e9ac30abcc38cb84b to your computer and use it in GitHub Desktop.
Super smol Elm bundles with Uglify-js@3
#!/bin/sh
set -e
js="bundle.js"
min="bundle.min.js"
elm make --optimize --output=$js src/Main.elm
./node_modules/.bin/uglifyjs $js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' | ./node_modules/.bin/uglifyjs --mangle --output $min
echo "Compiled size:$(cat $js | wc -c) bytes ($js)"
echo "Minified size:$(cat $min | wc -c) bytes ($min)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment