-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
125 lines (122 loc) · 3.2 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
srcCSS: {
src: [
'src/sass/*.scss',
],
dest: 'src/style.css',
},
scriptsJS: {
src: [
'src/scripts/*.js'
],
dest: 'src/scripts.js',
},
libsJS: {
src: [
'src/libs/*.js'
],
dest: 'src/libs.js',
}
},
htmlmin: { // Task
build: { // Target
options: { // Target options
removeComments: true,
collapseWhitespace: true
},
files: { // Dictionary of files
'build/index.html': 'src/index.html'
}
}
},
uglify: {
buildScripts: {
src: 'src/scripts/*.js',
dest: 'build/scripts.js'
},
buildLibs: {
src: 'src/libs/*.js',
dest: 'build/libs.js'
}
},
sass: {
build: {
options: {
style: 'compressed',
sourcemap: 'none'
},
files: {
'build/style.css': 'src/style.css'
}
},
src: {
options: {
style: 'expanded',
sourcemap: 'none'
},
files: {
'src/style.css': 'src/style.css'
}
}
},
watch: {
js: {
files: ['src/scripts/*.js'],
tasks: ['concat:libsJS', 'concat:scriptsJS']
},
css: {
files: ['src/sass/*.scss'],
tasks: ['concat:srcCSS', 'sass:src']
},
templates: {
files: ['src/partials/*.html'],
tasks: ['ngtemplates:src']
}
},
ngtemplates:{
build:{
options:{
module:'app', // (Optional) The module the templates will be added to
htmlmin: {
collapseWhitespace: true,
collapseBooleanAttributes: true
}
},
cwd: 'src/partials/',
src: '*.html',
dest:'build/templates.js'
},
src:{
options:{
base:'src/partials', // $templateCache ID will be relative to this folder
module:'app' // (Optional) The module the templates will be added to
},
cwd: 'src/partials/',
src: '*.html',
dest: 'src/templates.js'
}
},
connect: {
src: {
options: {
port: 8001,
keepalive: true,
base: 'src'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-angular-templates');
grunt.loadNpmTasks('grunt-contrib-connect');
// Default task(s).
grunt.registerTask('default', ['concat', 'htmlmin', 'uglify', 'sass', 'ngtemplates']);
};