From 071a2c166e8d5484d85775eb5ca646e1fb841c7d Mon Sep 17 00:00:00 2001 From: Arno Roldao Junior Date: Thu, 23 Jun 2016 11:49:39 -0300 Subject: [PATCH] remove task and using the task loader: "load-grunt-config" for load the modules of tasks of folder: "grunt-tasks" --- Gruntfile.js | 150 +++------------------------------------------------ 1 file changed, 6 insertions(+), 144 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index fd3c35c8..8ce332ec 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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']); -- GitLab