This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Gruntfile.js
105 lines (101 loc) · 1.9 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
module.exports = function(grunt) {
grunt.initConfig({
clean: {
dist: ["dist"],
temp: [".tmp"]
},
copy: {
dist: {
files: [{
expand: true,
cwd: '.tmp/final',
src: ['*.min.css', '*.min.js', '*.html'],
flatten: true,
dest: 'dist/'
}, {
expand: true,
cwd: 'images',
src: ['*'],
dest: 'dist/images'
}]
},
templated: {
files: [{
expand: true,
flatten: true,
src: ['.tmp/*.js', '.tmp/*.html'],
dest: 'dist/'
}]
}
},
cssmin: {
target: {
files: [{
expand: false,
src: ['cssmain.css'],
dest: '.tmp/final/combined.min.css',
}]
}
},
uglify: {
all_js: {
files: {
'.tmp/final/combined.min.js': ['.tmp/templated/jsmain.js']
}
}
},
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: [{
expand: true,
cwd: '.tmp/templated',
src: ['*.html'],
dest: '.tmp/final'
}]
}
},
includereplace: {
build_all: {
options: {
// Task-specific options go here.
},
// Files to perform replacements and includes with
src: ['jsmain.js', 'index.html', 'dep.html'],
// Destination directory to copy files to
dest: '.tmp/templated/'
}
},
connect: {
server: {
options: {
livereload: true,
base: 'dist/',
port: 8000
}
}
},
watch: {
html: {
files: ['*.js', '*.css', '**/*.html', '!dist/'],
tasks: ['build']
}
},
'gh-pages': {
options: {
base: 'dist'
},
src: ['**']
}
});
grunt.registerTask('build', ['clean:dist', 'clean:temp', 'includereplace:build_all', 'htmlmin:dist', 'uglify:all_js', 'cssmin', 'copy:dist', 'clean:temp']);
grunt.registerTask('serve', [
'build',
'connect:server',
'watch'
]);
require('load-grunt-tasks')(grunt);
};