-
Notifications
You must be signed in to change notification settings - Fork 6
/
gruntfile.js
58 lines (52 loc) · 1.55 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
module.exports = function(grunt) {
var path = require('path');
var _ = require('lodash');
var global_config = {
//path to task.js files, defaults to grunt dir
configPath: path.join(process.cwd(), 'grunt-tasks-config/'),
// auto grunt.initConfig
init: true,
// data passed into config ( => the basic grunt.initConfig(config) ). Can be used afterwards with < %= test % >
data: {
pkg: grunt.file.readJSON( 'package.json' ),
paths : {
front_js : 'assets/front/js/',
lang : 'lang/'
},
tasks : {
'dev': [ 'watch'],
//PROD
'build': [ 'jshint:front_js','uglify:front_js', 'replace', 'clean', 'copy', 'compress'],
},
uglify_requested_paths : {
src : '' || grunt.option('src'),
dest : '' || grunt.option('dest')
}
}
};
// LOAD GRUNT PACKAGES AND CONFIGS
// https://www.npmjs.org/package/load-grunt-config
require( 'load-grunt-config' )( grunt , global_config );
// REGISTER TASKS
_.map( grunt.config('tasks'), function(task, name) {
grunt.registerTask(name, task);
});
//DEV WATCH EVENT
//watch is enabled only in dev mode
grunt.event.on('watch', function(action, filepath, target) {
var files = [
{
expand: true,
cwd: '.',
src: [
filepath,
]
}
];
grunt.log.writeln( 'WATCH EVENT INFOS : ', grunt.task.current.name , action, filepath, target);
if ( 'jquery.sharrre.js' == target ) {
//if some js admin scripts have been changed in dev mode, jshint them dynamically
grunt.config('jshint.those', [filepath]);
}
});
};