forked from eralha/firebase-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
122 lines (112 loc) · 2.77 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
module.exports = function(grunt) {
/*
files: {
'dest/output.min.js': ['js/src/**\/*.js']
}
*/
//var path = "z:/"+grunt.option( "web" )+"/";
//var path = "c:/git/grunt/";
var path = "";
//CSS CONFIG
var outPutCss = path+"css/style.css";
var lessFiles = {};
lessFiles[outPutCss] = [
path+"css/less/_normalize.less",
path+"css/less/remixins.less",
path+"css/less/style.less"
];
var toMinifyCss = {};
toMinifyCss[outPutCss] = outPutCss;
//JAVASCRIPT CONFIG
var outputJs = path+"js/main.min.js";
var mainJsFile = {};
mainJsFile[outputJs] = [ path+'js/main.js' ];
var modulesToCompile = {
expand: true,
cwd: path+'js/src',
src: [ 'modules/*.js'],
dest: path+'js/dist/'
};
modulesToCompile = {
expand: true,
cwd: path+'js/src',
src: [
'ng/*.js',
'ng/services/*.js',
'ng/directives/*.js',
'ng/controlers/*.js',
'ng/controllers/*.js',
'lib/*.js',
'modules/*.js',
],
dest: path+'js/dist/'
};
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
css: {
files: [
path+"css/less/_normalize.less",
path+"css/less/remixins.less",
path+"css/less/style.less"
],
tasks: ['css'],
options: {
spawn: false,
}
},
src: {
files: [
path+'js/*.js',
path+'js/src/ng/*.js',
path+'js/src/ng/services/*.js',
path+'js/src/ng/directives/*.js',
path+'js/src/ng/controlers/*.js',
path+'js/src/ng/controllers/*.js'
],
tasks: ['js'],
options: {
spawn: false,
}
}
},//end-watch
uglify: {
options: {
compress: true,
mangle: {
except: ['jQuery', 'angular']
}
},
build: {
files: [
mainJsFile,
modulesToCompile
]
}
},
less: {
build: {
files: lessFiles
}
},
cssmin: {
combine: {
files: toMinifyCss
}
}
});
grunt.event.on('watch', function(action, filepath, target) {
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-cssmin');
// Default task(s).
grunt.registerTask('css', ['less', 'cssmin']);
grunt.registerTask('js', ['uglify']);
grunt.registerTask('w', ['watch']);
grunt.registerTask('default', ['less', 'cssmin', 'uglify']);
};