-
Notifications
You must be signed in to change notification settings - Fork 4
/
Gruntfile.js
60 lines (45 loc) · 1.25 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* jshint node:true */
module.exports = function( grunt ) {
'use strict';
// load all grunt tasks matching the `grunt-*` pattern
require( 'load-grunt-tasks' )( grunt );
// Show elapsed time
require( 'time-grunt' )( grunt );
var _ = require( 'underscore' );
var path = require( 'path' );
// Set plugin slug option
grunt.option( 'plugin-slug', path.basename( process.cwd() ) );
var gruntConfig = {};
// options
gruntConfig.options = {};
// Set folder templates
gruntConfig.dirs = {
css: 'assets/css',
js: 'assets/js',
images: 'assets/images',
fonts: 'assets/fonts',
build: 'build'
};
function loadConfig( filepath ) {
var object = {};
var key;
filepath = path.normalize( path.resolve( process.cwd(), filepath ) + '/' )
var files = grunt.file.glob.sync( '*', { cwd: filepath } );
files.forEach( function( option ) {
key = option.replace(/\.js$/,'');
object = _.extend( object, require( filepath + option )( grunt ) );
});
return object;
};
// load task configs
gruntConfig = _.extend( gruntConfig, loadConfig( './grunt/configs/' ) );
// Init Grunt
grunt.initConfig( gruntConfig );
// Register Tasks
grunt.registerTask( 'default', [
'makepot',
'clean:build_dir',
'copy:build',
'clean:build'
] );
};