-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathgruntfile.js
90 lines (78 loc) · 1.92 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
'use strict';
module.exports = function(grunt) {
var html_files = [
'build/index.html',
'build/intro.html',
'build/sponsoring.html',
'build/code-of-conduct.html'
];
grunt.initConfig({
/**
* shell commands to clean and build
* removes build and .tmp folder then copies src folder contents to build
*/
shell: {
options: {
stdout: true
},
clean: {
command: 'rm -rf build .tmp'
},
build: {
command: 'cp -r src build'
}
},
/**
* prepares usemin references in the referenced files ready for concat,
* uglify and cssmin
*/
useminPrepare: {
options: {
dest: 'build'
},
html: html_files
},
/**
* runs concat, uglify and cssmin on resources in referenced files
*/
usemin: {
html: html_files
},
/**
* create an md5 hash of each file referenced to append to the filename,
* allowing for long cache times
*/
rev: {
options: {
encoding: 'utf8',
algorithm: 'md5',
length: 8
},
css: {
src: ['build/styles/hoodie.min.css']
},
js: {
src: ['build/scripts/hoodie.min.js']
}
},
/**
* push the referenced folder to the repository's gh-pages branch
*/
'gh-pages': {
options: {
base: 'build'
},
src: ['**']
}
});
grunt.registerTask('clean', ['shell:clean', 'shell:build'])
grunt.registerTask('build', ['clean', 'useminPrepare', 'concat', 'uglify', 'cssmin', 'rev', 'usemin']);
grunt.registerTask('deploy', ['build', 'gh-pages']);
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-rev');
grunt.loadNpmTasks('grunt-usemin');
grunt.loadNpmTasks('grunt-gh-pages');
};