mirror of https://github.com/ColorlibHQ/AdminLTE
remove task and using the task loader: "load-grunt-config" for load the modules of tasks of folder: "grunt-tasks"
parent
fdd077c936
commit
071a2c166e
150
Gruntfile.js
150
Gruntfile.js
|
@ -3,153 +3,15 @@
|
||||||
module.exports = function (grunt) {
|
module.exports = function (grunt) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
// Load all grunt tasks
|
||||||
grunt.initConfig({
|
var configs = require('load-grunt-config')(grunt,{
|
||||||
watch: {
|
configPath: __dirname + '/grunt-tasks',
|
||||||
// If any .less file changes in directory "build/less/" run the "less"-task.
|
data:{
|
||||||
// files: ["build/less/*.less", "build/less/skins/*.less", "dist/js/app.js"],
|
pkg: grunt.file.readJSON("package.json")
|
||||||
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
|
grunt.initConfig(configs);
|
||||||
|
|
||||||
// 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');
|
|
||||||
|
|
||||||
// Linting task
|
// Linting task
|
||||||
grunt.registerTask('lint', ['jshint', 'csslint', 'bootlint']);
|
grunt.registerTask('lint', ['jshint', 'csslint', 'bootlint']);
|
||||||
|
|
Loading…
Reference in New Issue