Added jshint, clean and image plugins to lint JS files, remove build images and compress images respectively

pull/489/merge
Abdullah Almsaeed 9 years ago
parent 12996b0242
commit 13aa44fe14

@ -1,5 +1,14 @@
'use strict'; /*!
* Bootstrap's Gruntfile
* http://getbootstrap.com
* Copyright 2013-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
module.exports = function (grunt) { module.exports = function (grunt) {
'use strict';
grunt.initConfig({ grunt.initConfig({
watch: { watch: {
@ -86,15 +95,40 @@ module.exports = function (grunt) {
} }
} }
}, },
cssjanus: {
build: { // Optimize images
files: { image: {
'dist/css/AdminLTE-rtl.css': 'dist/css/AdminLTE.css', dynamic: {
'dist/css/AdminLTE-rtl.min.css': 'dist/css/AdminLTE.min.css', files: [{
'bootstrap/css/bootstrap-rtl.css': 'bootstrap/css/bootstrap.css', expand: true,
'bootstrap/css/bootstrap-rtl.min.css': 'bootstrap/css/bootstrap.min.css' cwd: 'build/img/',
} src: ['**/*.{png,jpg,gif,svg}'],
dest: 'dist/img/'
}]
}
},
// Validate JS code
jshint: {
options: {
jshintrc: '.jshintrc'
},
core: {
src: 'dist/js/app.js'
},
demo: {
src: 'dist/js/demo.js'
},
pages: {
src: 'dist/js/pages/*.js'
} }
},
// Delete images in build directory
// After compressing the images in the build/img dir, there is no need
// for them
clean: {
build: ["build/img/*"]
} }
}); });
@ -108,9 +142,13 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
// Include Files Within HTML // Include Files Within HTML
grunt.loadNpmTasks('grunt-includes'); grunt.loadNpmTasks('grunt-includes');
// Convert CSS to RTL // Optimize images
grunt.loadNpmTasks('grunt-cssjanus'); grunt.loadNpmTasks('grunt-image');
// Validate JS code
grunt.loadNpmTasks('grunt-contrib-jshint');
// Delete not needed files
grunt.loadNpmTasks('grunt-contrib-clean');
// The default task (running "grunt" in console) is "watch" // The default task (running "grunt" in console) is "watch"
grunt.registerTask('default', ['watch']); grunt.registerTask('default', ['watch']);
}; };
Loading…
Cancel
Save