degruntify js minifaction shave off 5K by optimizing uglify
PR: #595 PR-URL: https://github.com/apache/couchdb-fauxton/pull/595 Reviewed-By: Benjamin Keen <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/baf9ee9b Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/baf9ee9b Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/baf9ee9b Branch: refs/heads/master Commit: baf9ee9bd9efe69f1dce050d7cedf7e3c703f6e1 Parents: 16640f9 Author: Robert Kowalski <[email protected]> Authored: Mon Jan 4 18:13:53 2016 +0100 Committer: Robert Kowalski <[email protected]> Committed: Tue Jan 5 11:33:21 2016 +0100 ---------------------------------------------------------------------- Gruntfile.js | 17 +++++------------ package.json | 3 ++- 2 files changed, 7 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/baf9ee9b/Gruntfile.js ---------------------------------------------------------------------- diff --git a/Gruntfile.js b/Gruntfile.js index 5c00e44..e543815 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -181,16 +181,6 @@ module.exports = function (grunt) { } }, - uglify: { - release: { - files: { - "dist/release/js/require.js": [ - "dist/debug/js/require.js" - ] - } - } - }, - // Runs a proxy server for easier development, no need to keep deploying to couchdb couchserver: couchserver_config, @@ -353,6 +343,10 @@ module.exports = function (grunt) { command: 'npm run build:css-compress' }, + uglify: { + command: 'npm run build:uglify' + }, + stylecheckSingleFile: { command: '' // populated dynamically }, @@ -479,7 +473,6 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-jst'); grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-shell'); grunt.loadNpmTasks('grunt-md5'); @@ -503,7 +496,7 @@ module.exports = function (grunt) { // minify code and css, ready for release. grunt.registerTask('jsx', ['shell:build-jsx']); - grunt.registerTask('build', ['shell:build-less', 'jst', 'requirejs', 'concat:requirejs', 'uglify', + grunt.registerTask('build', ['shell:build-less', 'jst', 'requirejs', 'concat:requirejs', 'shell:uglify', 'shell:css-compress', 'md5:requireJS', 'md5:css', 'template:release']); /* http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/baf9ee9b/package.json ---------------------------------------------------------------------- diff --git a/package.json b/package.json index 4114e2e..26f0a95 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "grunt-contrib-copy": "~0.4.1", "grunt-contrib-jst": "~0.5.0", "grunt-contrib-requirejs": "~0.4.1", - "grunt-contrib-uglify": "~0.2.0", "grunt-couchapp": "~0.2.1", "grunt-exec": "~0.4.0", "grunt-init": "~0.2.0", @@ -43,6 +42,7 @@ "react-tools": "^0.12.0", "request": "^2.54.0", "send": "~0.1.1", + "uglify-js": "^2.6.1", "underscore": "~1.4.2", "url": "~0.7.9", "urls": "~0.0.3" @@ -51,6 +51,7 @@ "stylecheck": "eslint --ext=js,jsx .", "build:less": "mkdirp ./dist/debug/css && node ./build-helper/less.js", "build:css-compress": "mkdirp ./dist/release/css/ && cleancss -o dist/release/css/index.css dist/debug/css/index.css", + "build:uglify": "mkdirp ./dist/release/js/ && uglifyjs --mangle --compress --screw-ie8 -o dist/release/js/require.js dist/debug/js/require.js", "test": "grunt test", "couchdebug": "grunt couchdebug", "couchdb": "grunt couchdb",
