1
0
mirror of https://github.com/locomotivemtl/locomotive-boilerplate.git synced 2026-01-15 00:55:08 +08:00
Files
locomotive-boilerplate/Gruntfile.js

56 lines
1.0 KiB
JavaScript

module.exports = function(grunt) {
function loadConfig(path) {
var glob = require('glob');
var object = {};
var key;
glob.sync('*', {cwd: path}).forEach(function(option) {
key = option.replace(/\.js$/,'');
object[key] = require(path + option);
});
return object;
}
var config = {
pkg: grunt.file.readJSON('package.json')
}
grunt.loadTasks('build/grunt');
grunt.util._.extend(config, loadConfig('./build/grunt/'));
grunt.initConfig(config);
// Load tasks
require('load-grunt-tasks')(grunt);
// Register tasks
grunt.registerTask('default', ['build']);
grunt.registerTask('sync', ['browserSync', 'watch', 'notify:watch']);
grunt.registerTask('build', [
// CSS
'sass',
'postcss',
'cssmin',
// JS
'browserify:prod',
'uglify',
// SVG
'svgstore',
'svgmin',
// Notify
'notify:build'
]);
grunt.registerTask('w', ['watch', 'notify:watch']);
grunt.registerTask('c', [
'csscomb'
]);
grunt.registerTask('j', [
'eslint'
]);
grunt.registerTask('p', [
'phplint'
]);
};