Optimize generated build. (#150)

This commit is contained in:
Nicolas Perriault 2017-05-08 13:08:51 +02:00 committed by GitHub
parent 75de9b8c08
commit 68311725df
2 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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"
}
}