-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
97 lines (93 loc) · 2.8 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
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
// Task configuration.
sass: { // Task
dist: { // Target
options: { // Target options
style: 'expanded'
},
files: { // Dictionary of files
'static/css/main.min.css': 'bulma/bulma.sass' // 'destination': 'source'
}
}
},
uncss: {
options: {
ignore: [
'.attached',
'section.media-menu.attached',
'.navbar-fixed',
'.menu-attached',
'.hide',
'.films',
'section.media-menu.films',
'section.media-menu.television',
'.television',
'section.media-menu.game',
'section.media-menu.game span a',
'section.media-menu.films .menuitem span.active',
'section.media-menu.game .menuitem span.active',
'.menu-attached img, .menu-attached svg, .menu-attached rotato',
'.cls-1',
'.game .cls-1',
'.television .cls-1',
'.films .cls-1',
'section.media-menu.films span a',
'.game'
],
report: ['min']
},
dist: {
files: {
'static/css/main.min.css': ['static/index.html']
}
}
},
processhtml: {
dist: {
files: {
'static/index.html': ['index.html']
}
}
},
copy: {
main: {
files: [
{expand: true, src: ['img/**'], dest: 'static/'},
{expand: true, src: ['js/*'], dest: 'static/'},
],
},
},
cacheBust: {
main: {
options: {
baseDir: 'static/',
assets: ['js/**', 'css/**'],
queryString: true
},
src: ['static/index.html']
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-uncss');
grunt.loadNpmTasks('grunt-processhtml');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-cache-bust');
// Default task.
// Compile sass big.
// UNCSS and minify.
// Stash in Static.
// Update HTML to use new minified CSS and stash in static.
grunt.registerTask('default', ['sass', 'processhtml', 'uncss', 'copy', 'cacheBust' ]);
};