Skip to content

Commit

Permalink
Merge pull request #531 from rtfd/grunt-uglify
Browse files Browse the repository at this point in the history
Uglify during build
  • Loading branch information
davidfischer committed Jan 16, 2018
2 parents 266bc65 + 3a3da60 commit b4ab3f6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,26 @@ module.exports = function(grunt) {
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: {
bower_update: {
cmd: 'bower update'
Expand Down Expand Up @@ -162,5 +181,5 @@ module.exports = function(grunt) {
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('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']);
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-sass": "~1.0.0",
"grunt-contrib-uglify": "~3.3.0",
"grunt-contrib-watch": "~1.0.0",
"grunt-exec": "~1.0.1",
"grunt-open": "0.2.3",
Expand Down

0 comments on commit b4ab3f6

Please sign in to comment.