forked from maccman/motivation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
107 lines (101 loc) · 3.26 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'),
appName: 'app', // main angular module
src: 'extension/src/',
appSrc: '<%= src %>/**/*.js',
buildDir: 'extension/build',
tmp: '.build-cache',
appBuild: '<%= buildDir %>/<%= pkg.name %>',
templateSrc: '<%= src %>/**/*.html',
templateBuild: '<%= tmp %>/templates.js',
bowerBuild: '<%= buildDir %>/bower_components.js',
concat: {
app: {
src: [
'<%= appSrc %>',
'<%= templateBuild %>'
],
dest: '<%= tmp %>/<%= appBuild %>.js'
},
bower: {
src: [
'bower_components/angular/angular.js',
'bower_components/angular-ui-router/release/angular-ui-router.js',
],
dest: '<%= bowerBuild %>'
},
options: {
stripBanners: true,
}
},
sass: {
dist: {
files: {
'<%= buildDir %>/<%= pkg.name %>.css': '<%= src %>/app.scss'
},
options: {
style: 'compressed',
}
}
},
ngtemplates: {
app: {
src: '<%= templateSrc %>',
dest: '<%= templateBuild %>',
options: {
module: 'app',
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
}
}
},
ngAnnotate: {
app: {
files: {
'<%= appBuild %>.js': ['<%= tmp %>/<%= appBuild %>.js']
}
}
},
uglify: {
options: {
sourceMap: true,
},
app: {
files: {
'<%= appBuild %>.min.js': ['<%= appBuild %>.js']
}
}
},
watch: {
app: {
files: ['<%= appSrc %>'],
tasks: ['concat:app', 'ngAnnotate', 'uglify']
},
bower: {
files: ['<%= concat.bower.src %>'],
tasks: ['concat:bower']
},
css: {
files: ['<%= src %>/**/*.scss'],
tasks: ['sass']
},
html: {
files: ['<%= templateSrc %>'],
tasks: ['ngtemplates', 'concat:app', 'uglify']
}
},
clean: ['<%= tmp %>', '<%= buildDir %>']
});
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['newer:ngtemplates', 'newer:concat',
'newer:ngAnnotate', 'newer:uglify', 'sass']);
};