-
Notifications
You must be signed in to change notification settings - Fork 4
/
Gruntfile.js
172 lines (150 loc) · 4.53 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
module.exports = function(grunt) {
'use strict';
/**
* Setup configuration
*/
grunt.initConfig({
SERVE: grunt.file.readJSON('config/servefiles.json'),
PRODUCT: grunt.file.readJSON('config/banner.json'),
buildTags: "/* Project Name : <%= PRODUCT.application.name %> Release version : <%= PRODUCT.application.version %> */",
clean: {
build: ['<%= SERVE.build.clean.files %>']
},
shell: {
uglify: {
command: [
"node bower_components/rjs/dist/r.js -o config/build/optimize-build.js",
"node bower_components/rjs/dist/r.js -o config/build/copy-build.js",
"rm src/main-optimize.js",
"rm prod/main.js",
"mv prod/main-optimize.js prod/main.js",
"cp -r bower_components prod/bower_components"
].join('&&')
}
},
usebanner: {
buildTags: {
options: '<%= SERVE.build.banner.options %>',
files: {
src: '<%= SERVE.build.banner.files %>'
}
}
},
jshint: {
options: '<%= SERVE.lint.js.options %>',
all: '<%= SERVE.lint.js.files %>'
},
jscs: {
options: '<%= SERVE.lint.jscs.options %>',
src: '<%= SERVE.lint.jscs.files %>',
},
jsonlint: {
files: '<%= SERVE.lint.json.files %>'
},
csslint: {
strict: {
options: '<%= SERVE.lint.css.options %>',
src: '<%= SERVE.lint.css.files %>'
}
},
htmlhint: {
Root_HTML_Files: {
options: '<%= SERVE.lint.html.root.options %>',
src: '<%= SERVE.lint.html.root.files %>'
},
Templates: {
options: '<%= SERVE.lint.html.template.options %>',
src: '<%= SERVE.lint.html.template.files %>'
}
},
less: {
dev: {
options: '<%= SERVE.compile.less.options %>',
files: '<%= SERVE.compile.less.files %>'
}
},
watch: {
less: {
options: '<%= SERVE.watch.less.options %>',
files: '<%= SERVE.watch.less.files %>',
tasks: ['less:dev']
}
},
strip: {
main: {
src: '<%= SERVE.build.strip.files %>',
options: '<%= SERVE.build.strip.options %>'
}
},
htmlmin: {
dist: {
options: '<%= SERVE.build.minify.html.options %>',
files: '<%= SERVE.build.minify.html.files %>'
}
},
plato: {
report: {
files: {
'reports': '<%= SERVE.lint.reports.files %>'
}
}
}
});
/**
* Load tasks
*/
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-strip');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-htmlhint');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-jsonlint');
grunt.loadNpmTasks('grunt-banner');
grunt.loadNpmTasks('grunt-plato');
/**
* Define tasks : Tasks for development eco - system.
*/
grunt.registerTask('default', [
'htmlhint',
'jsonlint',
'jscs',
'jshint',
'compileLessDev',
'csslint',
'plato'
]);
/**
* Define tasks : Tasks for build eco - system.
*/
grunt.registerTask('build', [
'htmlhint',
'jsonlint',
'jscs',
'jshint',
'compileLessDev',
'csslint',
'plato',
'clean',
'strip',
'shell',
'htmlmin',
'usebanner'
]);
/**
* Define tasks : Tasks for less:compilation watch, Also alias for `watch`
*/
grunt.registerTask('watchless', ['watch:less']);
/**
* Define sub-tasks : Tasks for Less compilation for development.
*/
grunt.registerTask('compileLessDev', ['less:dev']);
/**
* Define sub-tasks : Alias for `plato`
*/
grunt.registerTask('analysis', ['plato']);
};