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,6 +1,15 @@
'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: {
// If any .less file changes in directory "build/less/" run the "less"-task. // If any .less file changes in directory "build/less/" run the "less"-task.
@ -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,8 +142,12 @@ 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