-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
108 lines (102 loc) · 2.14 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
module.exports = function(grunt) {
var app_js = [
'app/app.module.js',
'app/components/**/*.js'
];
var app_css = [
'assets/css/*.css'
];
// Project configuration
grunt.initConfig({
sass: {
dist: {
options: {
sourcemap: 'none'
},
files: [{
expand: true,
cwd: 'assets/scss/',
src: ['*.scss'],
dest: 'assets/css/',
ext: '.css'
}]
}
},
watch: {
sass: {
files: 'assets/scss/**/*.scss',
tasks: ['sass']
}/*,
tests: {
files: ['tests/!*.js', 'public/js/!*.js'],
tasks: ['karma:unit_auto']
}*/
},
/*karma: {
unit: {
configFile: './my.conf.js',
singleRun: true
},
unit_auto: {
configFile: './my.conf.js',
autoWatch: true
}
},*/
uglify: {
options: {
mangle: false
},
release_js: {
files: {
'./build/app.min.js': app_js
}
}
},
cssmin: {
options: {
keepSpecialComments: 0
},
target: {
files: {
'./build/app.min.css': app_css
}
}
},
injector: {
options: {
addRootSlash: false
},
prod_js: {
files: {
'./index.html': 'build/app.min.js'
}
},
prod_css: {
files: {
'./index.html': 'build/app.min.css'
}
},
dev_js: {
files: {
'./index.html': app_js
}
},
dev_css: {
files: {
'./index.html': app_css
}
}
}
});
// Tasks
//grunt.registerTask('test', ['karma:unit']);
grunt.registerTask('build:release', ['uglify', 'cssmin', 'injector:prod_js', 'injector:prod_css']);
grunt.registerTask('build:dev', ['injector:dev_js', 'injector:dev_css']);
// Load the plugins
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-injector');
//grunt.loadNpmTasks('grunt-karma');
};