-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
123 lines (115 loc) · 3.25 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
module.exports = function(grunt) {
// load all grunt tasks matching the ['grunt-*', '@*/grunt-*'] patterns
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jekyll: {
serve: {
options: {
serve: true,
dest: '_site',
config: '_config-dev.yml',
watch: true
}
},
build: {
options: {
dest: '_site',
config: '_config-dev.yml'
}
},
production: {
options: {
dest: '_site',
}
}
},
browserSync: {
files: {
src: ['_site/css/*.css', '_site/*.html']
},
proxy: 'localhost:4000'
},
uglify: {
global: {
files: {
"js/scripts.min.js": ["js/scripts.js"],
"js/vendor.min.js": ["js/vendor/*.js"]
}
}
},
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: 'images/',
src: ['**/*.{png,jpg,gif,svg}'],
dest: 'images/'
}]
}
},
sass: {
global: {
options: {
style: "compressed"
},
files: {
"css/main-unprefixed.css": "scss/main.scss"
}
}
},
autoprefixer: {
dist: {
files: {
'css/main.css': 'css/main-unprefixed.css'
}
}
},
critical: {
dist: {
options: {
base: './',
dimensions: [{
width: 1300,
height: 900
},
{
width: 500,
height: 900
}]
},
files: [
{src: ['_site/index.html'], dest: '_includes/critical-home.css'},
{src: ['_site/about.html'], dest: '_includes/critical-about.css'},
{src: ['_site/work.html'], dest: '_includes/critical-work.css'},
{src: ['_site/articles.html'], dest: '_includes/critical-articles.css'},
]
}
},
watch: {
html: {
files: "*.html",
tasks: ["jekyll:build"]
},
js: {
files: ["js/*.js", "!js/scripts.min.js", "!js/vendor.min.js"],
tasks: ["uglify"]
},
css: {
files: ["scss/*.scss"],
tasks: ["sass", "autoprefixer"]
}
},
concurrent: {
dev: ['jekyll:serve', 'browserSync', 'watch'],
options: {
logConcurrentOutput: true
}
}
});
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask("default", ["concurrent:dev"]);
grunt.registerTask("production", ["jekyll:production"]);
};