-
Notifications
You must be signed in to change notification settings - Fork 480
/
Gruntfile.js
executable file
·86 lines (84 loc) · 1.64 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
const sass = require('sass');
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
options: { livereload: true },
scss: {
files: ['src/sass/**/*.sass', 'src/sass/**/*.scss'],
tasks: ['sass', 'postcss'],
options: {
interrupt: true
}
},
pug: {
files: ['src/pug/**/*.pug'],
tasks: ['pug'],
options: {
interrupt: true
}
}
},
pug: {
compile: {
options: {
pretty: true
},
files: [{
src: ['**/*.pug', '!**/_*.pug'],
dest: "docs/",
ext: ".html",
cwd: "src/pug/",
expand: true
}]
}
},
sass: {
dist: {
options: {
implementation: sass,
outputStyle: 'expanded',
sourceMap: false
},
files: [{
expand: true,
cwd: 'src/sass/',
src: ['*.scss'],
dest: 'docs/css/',
ext: '.css'
}]
}
},
postcss: {
options: {
map: false,
processors: [
require('autoprefixer')({ overrideBrowserslist: 'last 2 versions' }), // add vendor prefixes
]
},
dist: {
src: ['docs/css/*.css']
}
},
cssmin: {
target: {
files: [{
expand: true,
cwd: 'docs/css',
src: ['*.css', '!*.min.css'],
dest: 'docs/css',
ext: '.min.css'
}]
}
}
});
// Load the Grunt plugins.
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-pug');
grunt.loadNpmTasks('grunt-contrib-watch');
// Set task aliases
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['pug', 'sass', 'postcss', 'cssmin']);
};