-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
114 lines (105 loc) · 3.12 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
module.exports = function (grunt) {
// Load NPM Tasks
require("matchdep").filter("grunt-*").forEach(grunt.loadNpmTasks);
grunt.initConfig({
// Base URL
base_url: '.',
// JS Folder URL
js_url: '<%= base_url %>/js',
// JS Build Folder URL
js_build_url: '<%= base_url %>/js_build',
// Lint through js files
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
trailing: true,
strict: true,
forin: true,
loopfunc: true,
ignores: ['<%= js_url %>/**/*.min.js', '<%= js_url %>/**/*.all.js']
},
files: ['<%= js_url %>/**/*.js']
},
// ngmin angular files to protect variable names
ngmin: {
controllers: {
expand: true,
cwd: '<%= js_build_url %>',
src: ['controllers/**/*.js'],
dest: '<%= js_build_url %>/controllers'
},
directives: {
expand: true,
cwd: '<%= js_build_url %>',
src: ['directives/**/*.js'],
dest: '<%= js_build_url %>/directives'
},
filters: {
expand: true,
cwd: '<%= js_build_url %>',
src: ['filters/**/*.js'],
dest: '<%= js_build_url %>/filters'
},
views: {
expand: true,
cwd: '<%= js_build_url %>',
src: ['views/**/*.js'],
dest: '<%= js_build_url %>/views'
}
},
// delete files
clean: {
build: ['<%= js_build_url %>']
},
// copy files to build
copy: {
build: {
files: [
{
expand: true,
cwd: '<%= js_url %>/',
src: ['**'],
dest: '<%= js_build_url %>/'
}
]
}
},
requirejs: {
build: {
options: {
almond: true,
name: 'main',
compress: 'none',
baseUrl: '<%= js_build_url %>',
mainConfigFile: '<%= js_build_url %>/main.js',
out: '<%= js_build_url %>/main.build.js',
preserveLicenseComments: false,
loglevel: 0
}
}
},
uglify: {
build: {
options: {
mangle: false
},
files: {
'<%= js_url %>/main.min.js': ['<%= js_build_url %>/main.build.js']
}
}
}
});
// Register tasks
grunt.registerTask('default', ['build']);
grunt.registerTask('test', ['jshint']);
grunt.registerTask('build', [
'jshint',
'copy',
'ngmin',
'requirejs',
'uglify:build',
'clean'
]);
};