-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
100 lines (97 loc) · 2.13 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
module.exports = function (grunt) {
grunt.initConfig({
clean : {
build : [
'build'
]
},
sass: {
options: {
sourceMap: true
},
dist: {
files: {
'build/css/main.css': 'src/css/main.scss'
}
}
},
wintersmith_compile: {
production: {
options: {
config: 'config.build.json',
output: 'build'
}
},
develop: {
options: {
config: 'config.json',
output: 'build'
}
}
},
postcss: {
options: {
map: true, // inline sourcemaps
processors: [
require('pixrem')(), // add fallbacks for rem units
require('autoprefixer')({browsers: 'last 2 versions'}), // add vendor prefixes
require('cssnano')() // minify the result
]
},
dist: {
src: 'build/css/*.css'
}
},
uncss: {
dist: {
options: {},
files: {
'build/css/main.css': ['build/*.html', 'build/page/*.html', 'build/articles/*.html']
}
}
},
copy: {
main: {
files: [
{expand: true, src: ['src/cache.manifest'], dest: 'build', flatten: true, filter: 'isFile'},
],
},
},
hashres : {
options : {
encoding : 'utf8',
fileNameFormat : '${name}.${hash}.cache.${ext}',
renameFiles : true
},
css : {
options : {},
src : ['build/css/*.css'],
dest : 'build/**/*.html'
}
}
});
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-wintersmith-compile');
grunt.loadNpmTasks('grunt-hashres');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-uncss');
grunt.loadNpmTasks('grunt-postcss');
grunt.registerTask('default', [
'clean:build',
'sass',
'wintersmith_compile:production',
'copy',
'postcss',
//'hashres:css'
]);
grunt.registerTask('dev', [
'clean:build',
'sass',
'wintersmith_compile:develop',
'copy',
'postcss',
//'hashres:css'
]);
};