(js) Enable jshint and uglify

This commit is contained in:
Francis Lachapelle 2015-07-24 15:22:35 -04:00
parent f09c06f8c4
commit 843a689094
2 changed files with 15 additions and 9 deletions

View file

@ -55,16 +55,20 @@ module.exports = function(grunt) {
src: 'css/styles.css' src: 'css/styles.css'
} }
}, },
concat_sourcemap: { jshint: {
files: [].concat(Object.keys(js_files).map(function(v) { return js_files[v]; }))
},
uglify: {
options: {
sourceMap: true
},
dist: { dist: {
options: {
sourcesContent: false
},
files: js_files files: js_files
}, },
dev: { dev: {
options: { options: {
sourcesContent: true mangle: false,
sourceMapIncludeSources: true
}, },
files: js_files files: js_files
} }
@ -86,7 +90,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-sass'); grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-postcss'); grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-concat-sourcemap'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.task.registerTask('static', function() { grunt.task.registerTask('static', function() {
@ -151,10 +156,10 @@ module.exports = function(grunt) {
} }
*/ */
}); });
grunt.task.registerTask('build', ['static', 'concat_sourcemap:dist', 'sass:dist', 'postcss:dist']); grunt.task.registerTask('build', ['static', 'uglify:dist', 'sass:dist', 'postcss:dist']);
// Tasks for developers // Tasks for developers
grunt.task.registerTask('default', ['watch']); grunt.task.registerTask('default', ['watch']);
grunt.task.registerTask('css', ['sass:dev', 'postcss:dev']); grunt.task.registerTask('css', ['sass:dev', 'postcss:dev']);
grunt.task.registerTask('js', ['concat_sourcemap:dev']); grunt.task.registerTask('js', ['jshint', 'uglify:dev']);
grunt.task.registerTask('dev', ['css', 'js']); grunt.task.registerTask('dev', ['css', 'js']);
}; };

View file

@ -7,7 +7,8 @@
"csswring": ">=3.0.0", "csswring": ">=3.0.0",
"grunt": ">=0.4.1", "grunt": ">=0.4.1",
"grunt-cli": ">=0.1.11", "grunt-cli": ">=0.1.11",
"grunt-concat-sourcemap": ">=0.4.3", "grunt-contrib-jshint": ">=0.11.2",
"grunt-contrib-uglify": ">=0.9",
"grunt-contrib-watch": ">=0.5.3", "grunt-contrib-watch": ">=0.5.3",
"grunt-ng-annotate": ">=0.10.0", "grunt-ng-annotate": ">=0.10.0",
"grunt-postcss": "^0.3.0", "grunt-postcss": "^0.3.0",