Minify compiled Elm modules! 📦
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
examples
perf
src
test
.gitignore
.travis.yml
example.gif
license
original.sh
package-lock.json
package.json
readme.md

readme.md

Elm Minify

Minify compiled Elm modules!

version build

Running elm make --optimize <ELM MODULE> doesn't produce particularily small assets on its own. Running elm-minify on these assets makes them more than 6 times smaller for my examples.

This package aims to provide whatever you need to minify the assets produced by the Elm compiler.

Get Started

The CLI is distributed through NPM. Here's how it works:

#1 install
npm i -g elm-minify

#2 compile. "--optimize" is important!
elm make --optimize --output=dist/main.js

#3 minify to "dist/main.min.js"
elm-minify dist/main.js

CLI

The CLI allows you to easily minify your Elm binaries. It has a number of flags to modify behavior described using the --help flag:

elm-minify --help

If it doesn't fit your needs or something isn't working, let me know with a fresh issue!

Node.js API

This package exposes a node module from it's root. It gives programmatic access to elm-minify for various purposes described here:

WebpackPlugin

() => Webpack Plugin

Plug elm-minify into Webpack. The plugin will, running in production mode, detect when Webpack is loading files optimized with elm-webpack-loader, and minify their content before bundling. The overhead of using this compared to the CLI is ~600 bytes for my examples. The Webpack configuration can be found here.

minify

(elmJs : String) => String

Minify compiled elm code synchronously

terserConfig

Terser Configuration

Get the Terser configuration for mangling and compressing Elm code.