|
|
|
@ -3,153 +3,15 @@
|
|
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
grunt.initConfig({
|
|
|
|
|
watch: {
|
|
|
|
|
// If any .less file changes in directory "build/less/" run the "less"-task.
|
|
|
|
|
// files: ["build/less/*.less", "build/less/skins/*.less", "dist/js/app.js"],
|
|
|
|
|
files: ["build/scss/*.scss", "build/scss/skins/*.scss", "dist/js/app.js"],
|
|
|
|
|
tasks: ["sass", "uglify"]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// SASS compiler
|
|
|
|
|
sass: {
|
|
|
|
|
development: {
|
|
|
|
|
options: {
|
|
|
|
|
style: 'expanded'
|
|
|
|
|
},
|
|
|
|
|
files: {
|
|
|
|
|
'dist/tmp/AdminLTE.css': 'build/scss/AdminLTE.scss'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
production: {
|
|
|
|
|
options: {
|
|
|
|
|
style: 'compressed'
|
|
|
|
|
},
|
|
|
|
|
files: {
|
|
|
|
|
'dist/tmp/AdminLTE.min.css': 'build/scss/AdminLTE.scss'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// Uglify task info. Compress the js files.
|
|
|
|
|
uglify: {
|
|
|
|
|
options: {
|
|
|
|
|
mangle: true,
|
|
|
|
|
preserveComments: 'some'
|
|
|
|
|
},
|
|
|
|
|
my_target: {
|
|
|
|
|
files: {
|
|
|
|
|
'dist/js/app.min.js': ['dist/js/app.js']
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// Compile ECMA6 to ECMA5
|
|
|
|
|
babel: {
|
|
|
|
|
options: {
|
|
|
|
|
sourceMap: true,
|
|
|
|
|
presets: ['es2015']
|
|
|
|
|
},
|
|
|
|
|
dist: {
|
|
|
|
|
files: {
|
|
|
|
|
'dist/js/AdminLTE.js': 'build/js/AdminLTE.js'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// Build the documentation files
|
|
|
|
|
includes: {
|
|
|
|
|
build: {
|
|
|
|
|
src: ['*.html'], // Source files
|
|
|
|
|
dest: 'documentation/', // Destination directory
|
|
|
|
|
flatten: true,
|
|
|
|
|
cwd: 'documentation/build',
|
|
|
|
|
options: {
|
|
|
|
|
silent: true,
|
|
|
|
|
includePath: 'documentation/build/include'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// Optimize images
|
|
|
|
|
image: {
|
|
|
|
|
dynamic: {
|
|
|
|
|
files: [{
|
|
|
|
|
expand: true,
|
|
|
|
|
cwd: 'build/img/',
|
|
|
|
|
src: ['**/*.{png,jpg,gif,svg,jpeg}'],
|
|
|
|
|
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'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// Validate CSS files
|
|
|
|
|
csslint: {
|
|
|
|
|
options: {
|
|
|
|
|
csslintrc: 'build/less/.csslintrc'
|
|
|
|
|
},
|
|
|
|
|
dist: [
|
|
|
|
|
'dist/css/AdminLTE.css',
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// Validate Bootstrap HTML
|
|
|
|
|
bootlint: {
|
|
|
|
|
options: {
|
|
|
|
|
relaxerror: ['W005']
|
|
|
|
|
},
|
|
|
|
|
files: ['pages/**/*.html', '*.html']
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// Delete images in build directory
|
|
|
|
|
// After compressing the images in the build/img dir, there is no need
|
|
|
|
|
// for them
|
|
|
|
|
clean: {
|
|
|
|
|
build: ["build/img/*"]
|
|
|
|
|
// Load all grunt tasks
|
|
|
|
|
var configs = require('load-grunt-config')(grunt,{
|
|
|
|
|
configPath: __dirname + '/grunt-tasks',
|
|
|
|
|
data:{
|
|
|
|
|
pkg: grunt.file.readJSON("package.json")
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Load all grunt tasks
|
|
|
|
|
|
|
|
|
|
// LESS Compiler
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-less');
|
|
|
|
|
// SASS compiler
|
|
|
|
|
grunt.loadNpmTasks('grunt-sass');
|
|
|
|
|
// Watch File Changes
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
|
// Compress JS Files
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
|
// Include Files Within HTML
|
|
|
|
|
grunt.loadNpmTasks('grunt-includes');
|
|
|
|
|
// Optimize images
|
|
|
|
|
grunt.loadNpmTasks('grunt-image');
|
|
|
|
|
// Validate JS code
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
|
// Delete not needed files
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
|
|
|
// Lint CSS
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-csslint');
|
|
|
|
|
// Lint Bootstrap
|
|
|
|
|
grunt.loadNpmTasks('grunt-bootlint');
|
|
|
|
|
// Grunt Babel to compile ECMA6 to ECMA5
|
|
|
|
|
grunt.loadNpmTasks('grunt-babel');
|
|
|
|
|
grunt.initConfig(configs);
|
|
|
|
|
|
|
|
|
|
// Linting task
|
|
|
|
|
grunt.registerTask('lint', ['jshint', 'csslint', 'bootlint']);
|
|
|
|
|