Merge pull request #531 from rtfd/grunt-uglify

Uglify during build
This commit is contained in:
David Fischer 2018-01-16 09:25:49 -08:00 committed by GitHub
commit b4ab3f6714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 2 deletions

View File

@ -111,7 +111,26 @@ module.exports = function(grunt) {
dest: 'sphinx_rtd_theme/static/js/theme.js' dest: 'sphinx_rtd_theme/static/js/theme.js'
} }
}, },
uglify: {
dist: {
options: {
sourceMap: false,
mangle: {
reserved: ['jQuery'] // Leave 'jQuery' identifier unchanged
},
ie8: true // compliance with IE 6-8 quirks
},
files: [{
expand: true,
src: ['sphinx_rtd_theme/static/js/*.js', '!sphinx_rtd_theme/static/js/*.min.js'],
dest: 'sphinx_rtd_theme/static/js/',
rename: function (dst, src) {
// Use unminified file name for minified file
return src;
}
}]
}
},
exec: { exec: {
bower_update: { bower_update: {
cmd: 'bower update' cmd: 'bower update'
@ -162,5 +181,5 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-browserify'); grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('default', ['exec:bower_update','clean','copy:fonts','sass:dev','browserify:dev','exec:build_sphinx','connect','open','watch']); grunt.registerTask('default', ['exec:bower_update','clean','copy:fonts','sass:dev','browserify:dev','exec:build_sphinx','connect','open','watch']);
grunt.registerTask('build', ['exec:bower_update','clean','copy:fonts','sass:build','browserify:build','exec:build_sphinx']); grunt.registerTask('build', ['exec:bower_update','clean','copy:fonts','sass:build','browserify:build','uglify','exec:build_sphinx']);
} }

View File

@ -12,6 +12,7 @@
"grunt-contrib-connect": "^1.0.2", "grunt-contrib-connect": "^1.0.2",
"grunt-contrib-copy": "~1.0.0", "grunt-contrib-copy": "~1.0.0",
"grunt-contrib-sass": "~1.0.0", "grunt-contrib-sass": "~1.0.0",
"grunt-contrib-uglify": "~3.3.0",
"grunt-contrib-watch": "~1.0.0", "grunt-contrib-watch": "~1.0.0",
"grunt-exec": "~1.0.1", "grunt-exec": "~1.0.1",
"grunt-open": "0.2.3", "grunt-open": "0.2.3",