-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
128 lines (114 loc) · 3.13 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
module.exports = function(grunt) {
var jsTemp = 'temp/app.js';
var jsVendors = [
"scripts/vendors/angular.min.js",
"scripts/vendors/jquery-3.2.1.min.js",
"scripts/vendors/rangeslider.js",
//"scripts/vendors/pdf.worker.js",
"scripts/vendors/pdf.js",
"scripts/vendors/pako.min.js",
"scripts/vendors/jszip.min.js",
"scripts/vendors/UPNG.js",
"scripts/vendors/UZIP.js",
"scripts/vendors/image-compressor.js",
];
var jsPriority = [
"scripts/app/app.js",
"scripts/app/models/*.js",
"build/templates.js",
"scripts/app/directives/*.js",
"scripts/app/filters/*.js",
"scripts/app/controllers/*.js",
"scripts/app/controllers/*/*.js"
];
grunt.initConfig({
concat: {
rel :{
src: jsVendors.concat([jsTemp]),
dest: 'build/scripts.js'
},
temp :{
src: jsPriority,
dest: 'temp/app.es6.js'
}
},
watch: {
jsTemp: {
files: jsPriority,
tasks: ['concat:temp', 'babel'] //, 'uglify'
},
jsAll: {
files: [jsTemp],
tasks: ['concat:rel'] //, 'uglify'
},
less: {
files: ['styles/**.less', 'styles/*/*.less'],
tasks: ['less']
},
templates: {
files: ['templates/*.html', 'templates/*/*.html'],
tasks: ['ngtemplates']
},
/*build: {
files: ['build/*.*', 'index.html'],
tasks: ['assets_inline']
}*/
},
babel: {
options: {
sourceMap: false,
presets: ['env']
},
dist: {
files: {
'temp/app.js': 'temp/app.es6.js'
}
}
},
uglify : {
my_target: {
files: {
'build/scripts.js' : ['build/scripts.js']
}
}
},
ngtemplates: {
App: {
src: ['templates/*.html', 'templates/*/*.html'],
dest: 'build/templates.js',
options: {}
}
},
less: {
options: {
compress: true,
ieCompat: true
},
styles: {
files: {
'build/styles.css': ['styles/@includes.less']
}
}
},
assets_inline: {
options: {
inlineSvg: true,
inlineSvgBase64: true,
inlineImg: true,
inlineLinkTags: true
},
all: {
files: {
'compressor.html': 'index.html'
}
}
}
});
['grunt-contrib-concat', 'grunt-contrib-watch', 'grunt-assets-inline', 'grunt-babel',
'grunt-contrib-uglify', 'assemble-less', 'grunt-angular-templates']
.forEach(function(task) {
grunt.loadNpmTasks(task);
});
grunt.registerTask('default', ['ngtemplates', 'concat:temp', 'babel', 'concat:rel', 'less', 'watch']); //, 'uglify'
grunt.registerTask('build', ['ngtemplates', 'concat:temp', 'babel', 'concat:rel', 'less', 'uglify', 'assets_inline']); //
};