forked from patrickjahns/esp_rgbww_webinterface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
107 lines (103 loc) · 3.91 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
module.exports = function(grunt) {
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
'string-replace': {
dist: {
files: [
{expand: true, cwd: 'build/', src: 'main-minsafe.js', dest: 'build/'},
{expand: true, cwd: 'src/', src: 'init.html', dest: 'build/'},
{expand: true, cwd: 'src/', src: 'index.html', dest: 'build/'}
],
options: {
replacements: [{
pattern: /{{ VERSION }}/g,
replacement: '<%= pkg.version %>'
}]
}
}
},
ngAnnotate: {
options: {
singleQuotes: true
},
app: {
files: {
'build/main-minsafe.js': [
'src/js/app.js',
'src/js/app.common.js',
'src/js/controller.init.js',
'src/js/controller.main.js',
'src/js/controller.okcancelctrl.js',
'src/js/controller.otactrl.js',
'src/js/controller.connectionctrl.js',
'src/js/controller.toastctrl.js',
'src/js/directive.svgicon.js',
'src/js/directive.wificon.js',
'src/js/factory.espcon.js',
'src/js/factory.offlineinterceptor.js'
]
}
}
},
concat: { // concatination task settings
dist: {
src: [
'src/style.css',
'bower_components/angular-material/angular-material.min.css'
],
dest: 'build/app.css',
}
},
cssmin:{
target: {
files: {
'build/app.min.css': ['build/app.css']
}
}
},
uglify: {
dist: {
options: {
sourceMap: true,
},
files: {
'build/app.min.js': ['bower_components/angular/angular.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-aria/angular-aria.js',
'bower_components/angular-material/angular-material.js',
'src/js/tinycolor.js',
'src/js/mdColorPicker.js',
'build/main-minsafe.js']
}
}
},
compress: {
main: {
options: {
mode: 'gzip',
level: 9
},
files: [
{expand: true, cwd: 'build/', src: ['*.html'], dest:'dist', ext: '.html.gz'},
{expand: true, cwd: 'build/', src: ['app.min.js'], dest:'dist', ext: '.min.js.gz'},
{expand: true, cwd: 'build/', src: ['app.min.css'], dest:'dist', ext: '.min.css.gz'},
]
}
},
});
grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-contrib-concat'); // which NPM packages to load
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-ng-annotate');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.registerTask('version', 'output version', function() {
pkg = grunt.file.readJSON('package.json');
grunt.file.write('VERSION', pkg.version);
});
grunt.registerTask('cleanup', 'cleanup tmp files', function() {
grunt.file.delete('build', [{force:true}]);
});
grunt.registerTask('default', ['ngAnnotate', 'string-replace', 'concat', 'uglify', 'cssmin', 'compress']);
grunt.registerTask('release', ['default', 'version']);
};