-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
108 lines (96 loc) · 3.81 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) {
// All upfront config goes in a massive nested object.
grunt.initConfig({
distFolder: 'public',
// Concatenate JS task
concat: {
// Common options for all concatenate task
options: {
process: function(src, filepath) {
return '// File : ' + filepath + '\n' + src;
}
},
// Concatenate libraries
lib: {
src: [
'bower_components/jquery/dist/jquery.js',
'bower_components/jquery-ui/jquery-ui.js',
'bower_components/bootstrap/dist/js/bootstrap.js',
'bower_components/ng-file-upload/angular-file-upload-shim.js',
'bower_components/angular/angular.min.js',
'bower_components/angular-route/angular-route.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
'bower_components/angular-ui-sortable/sortable.js',
'bower_components/ng-file-upload/angular-file-upload.js'
],
dest: '<%= distFolder %>/js/lib.js'
},
lib_min: {
src: [
'bower_components/jquery/dist/jquery.min.js',
'bower_components/jquery-ui/jquery-ui.min.js',
'bower_components/bootstrap/dist/js/bootstrap.min.js',
'bower_components/ng-file-upload/angular-file-upload-shim.min.js',
'bower_components/angular/angular.min.js',
'bower_components/angular-route/angular-route.min.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
'bower_components/angular-ui-sortable/sortable.min.js',
'bower_components/ng-file-upload/angular-file-upload.min.js'
],
dest: '<%= distFolder %>/js/lib.min.js'
},
// Concatenate app
app: {
// Wrap all application into an anonymous auto-callable function using 'use strict' env ( as recommended for angular app)
options: {
banner: '(function() {\n',
footer: '\n})();'
},
src: [
// Load module files
'app/core/**/module.js',
'app/modules/**/module.js',
// Load src code
'app/core/**/*.js',
'app/modules/**/*.js',
// Load routes
'app/core/**/routes.js',
'app/modules/**/routes.js',
// Load app root file when all others are loaded
'app/app.js'
],
dest: '<%= distFolder %>/js/app.js'
}
},
// Uglify JS task
uglify: {
// Uglify app
app: {
src: [
'<%= distFolder %>/js/app.js'
],
dest: '<%= distFolder %>/js/app.min.js'
}
},
// Compile LESS files task
less: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
app: {
src: [
'less/bootstrap-app.less'
],
dest: '<%= distFolder %>/css/app.min.css'
}
}
});
// Load Grunt task runners
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
// Register our own custom task alias.
grunt.registerTask('build', ['concat', 'uglify', 'less']);
};