diff --git a/README.md b/README.md index 5513c1d..8119fff 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,20 @@ An [experimental Mastodon client](https://n1k0.github.io/tooty/) written in Elm. $ npm run build +### Optimizing + + $ npm run optimize + +This command compresses and optimizes the generated js bundle. It usually allows reducing its size by ~75%, at the cost of the JavaScript code being barely readable. Use this command for deploying tooty to production. + ### Deploying to gh-pages $ npm run deploy The app should be deployed to https://[your-github-username].github.io/tooty/ +Note: The `deploy` command uses the `optimize` one internally. + ### Launching testsuite $ npm test diff --git a/package.json b/package.json index fab8695..32dbd24 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "build": "npm run copy-assets && node_modules/.bin/elm-make src/Main.elm --output=build/app.js", "copy-assets": "rimraf build && mkdir build && cp -r public/* build", "debug": "node_modules/.bin/elm-live src/Main.elm --warn --dir=public/ --output=public/app.js --debug", - "deploy": "npm run build && node_modules/.bin/gh-pages --dist build/", + "deploy": "npm run build && npm run optimize && node_modules/.bin/gh-pages --dist build/", + "optimize": "node_modules/.bin/uglifyjs build/app.js -c -m -o build/app.js", "start": "node_modules/.bin/elm-live src/Main.elm --warn --dir=public/ --output=public/app.js", "test": "node_modules/.bin/elm-test" }, @@ -28,6 +29,7 @@ "elm-live": "^2.7.4", "elm-test": "^0.18.2", "gh-pages": "^0.12.0", - "rimraf": "^2.6.1" + "rimraf": "^2.6.1", + "uglify-js": "^3.0.1" } }