forked from devshelf/devshelf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
executable file
·108 lines (98 loc) · 3.2 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) {
// Tasks
grunt.initConfig({
copy: {
img: {
files: [
{
expand: true,
cwd: 'public/assets/img/',
src: '**',
dest: 'public/build/img/'
}
]
}
},
clean: {
build: {
src: ['public/build/']
}
},
csso: {
main: {
files: {
'public/build/css/all.min.css': [
'public/assets/css/pure.css',
'public/assets/css/font-awesome.css',
'public/assets/css/main.css',
'public/assets/css/pricing.css',
'public/assets/css/blog.css',
'public/assets/css/form.css',
'public/assets/css/jquery.autoSuggest.css'
]
}
}
},
uglify: {
main: {
files: {
'public/build/js/all.min.js': [
'public/assets/js/utils.js',
'public/assets/js/mustache.js',
'public/assets/js/main.js',
'public/assets/js/auth.js',
'public/assets/js/voting.js',
'public/assets/js/jquery.autoSuggest.js',
'public/assets/js/form.js'
]
}
}
},
htmlcompressor: {
main: {
files: {
'public/build/index.html': 'public/index.html',
'public/build/templates.html': 'public/templates.html'
},
options: {
type: 'html',
preserveServerScript: true
}
}
},
hashres: {
main: {
// Files to hash
src: [
'public/build/js/all.min.js',
'public/build/css/all.min.css'],
// File that refers to above files and needs to be updated with the hashed name
dest: 'public/build/index.html'
}
},
watch: {
main: {
files: [
'public/assets/**/*',
'public/templates.html',
'public/index.html'
],
tasks: ['csso:main','uglify:main','htmlcompressor:main','hashres:main'],
options: {
nospawn: true
}
}
}
});
// Load plugins installed via npm install
grunt.loadNpmTasks('grunt-csso');
grunt.loadNpmTasks('grunt-htmlcompressor');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-hashres');
//TODO: process only new files, add modules loader
grunt.registerTask('default', ['clean:build','csso:main','uglify:main','htmlcompressor:main','copy:img','hashres:main']);
grunt.registerTask('runWatch', ['watch']);
};