-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
140 lines (136 loc) · 3.67 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
module.exports = function(grunt) {
grunt.initConfig({
less: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
compile: {
expand: true,
cwd: 'app/src/assets/less/',
src: ['*.less', '!**/variables.less', '!**/font-standards.less', '!**/mixins.less'],
dest: 'app/src/assets/css/',
ext: '.css'
}
},
bowercopy: {
options: {
srcPrefix: 'bower_components'
},
css: {
options: {
destPrefix: 'app/src/lib/css'
},
files: {
'angular-material/angular-material.min.css': 'angular-material/angular-material.min.css'
}
},
js: {
options: {
destPrefix: 'app/src/lib/js'
},
files: {
'angular/angular.min.js': 'angular/angular.min.js',
'angular-animate/angular-animate.min.js': 'angular-animate/angular-animate.min.js',
'angular-aria/angular-aria.min.js': 'angular-aria/angular-aria.min.js',
'angular-ui-router/angular-ui-router.min.js': 'angular-ui-router/release/angular-ui-router.min.js'
}
}
},
connect: {
server: {
options: {
port: 3000,
hostname: '*',
base: 'app/src/',
livereload: true
}
}
},
watch: {
styles: {
files: [
'**/*.less'
],
tasks: ['less'],
options: {
nospawn: true
}
},
all: {
files: '**/*.html',
options: {
livereload: true
}
}
},
uglify: {
options: {
compress: false,
mangle: false,
sourceMap: true
},
build: {
files: {
'app/prod/assets/js/uglify-all/all.min.js': ['app/src/app.js', 'app/src/assets/js/**/*.js', '!**/angular/*', '!**/angular-ui-router/*']
}
}
},
htmlmin: {
options: {
removeComments: true,
collapseWhitespace: true,
minifyJS: true
},
prod: {
files: {
'app/production/index.html': 'app/development/index.html',
'app/production/views/about/about.html': 'app/development/views/about/about.html',
'app/production/views/work/work.html': 'app/development/views/work/work.html',
'app/production/views/work/sub/animalfax.html': 'app/development/views/work/sub/animalfax.html',
'app/production/views/work/sub/logoji-labs.html': 'app/development/views/work/sub/logoji-labs.html',
'app/production/views/work/sub/printaire.html': 'app/development/views/work/sub/printaire.html',
'app/production/views/work/sub/spur.html': 'app/development/views/work/sub/spur.html',
'app/production/views/contact/contact.html': 'app/development/views/contact/contact.html',
'app/production/views/blog/blog.html': 'app/development/views/blog/blog.html'
}
}
},
copy: {
prod: {
cwd: 'app/src/assets',
src: ['css/*', 'fonts/*', 'img/*'],
dest: 'app/prod/assets',
expand: true
}
},
compress: {
prod: {
options: {
mode: 'gzip'
},
cwd: 'app/prod',
src: ['assets/css/*.css', 'assets/js/uglify-all/*.js', 'views/**/*.html', 'index.html'],
dest: 'app/production',
expand: true,
ext: '.gz'
}
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-bowercopy');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.registerTask('default', ['bowercopy', 'connect', 'watch']);
grunt.registerTask('uglify-all', ['uglify']);
grunt.registerTask('htmlmin-all', ['htmlmin']);
grunt.registerTask('compress-all', ['compress']);
// Automate everything for production
// TODO: update copy to copy over libs
grunt.registerTask('prod', ['copy', 'uglify', 'htmlmin', 'compress']);
};