This repository has been archived by the owner on Apr 8, 2021. It is now read-only.
forked from bassjobsen/bootstrap-styleguide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
169 lines (159 loc) · 4.88 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*!
*/
module.exports = function (grunt) {
'use strict';
// Force use of Unix newlines
grunt.util.linefeed = '\n';
RegExp.quote = function (string) {
return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
};
var config = {
node: { path: 'node_modules/'}
};
var mq4HoverShim = require('mq4-hover-shim');
var autoprefixer = require('autoprefixer')([
"Chrome >= 45",
"Firefox ESR",
"Edge >= 12",
"Explorer >= 10",
"iOS >= 9",
"Safari >= 9",
"Android >= 4.4",
"Opera >= 30"
]);
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
config: config,
// Task configuration.
clean: {
dist: '_site',
},
concat: {
bootstrap: {
src: [
'<%= config.node.path %>jquery/dist/jquery.min.js',
'<%= config.node.path %>popper.js/dist/umd/popper.min.js',
'<%= config.node.path %>bootstrap/dist/js/bootstrap.min.js',
'assets/js/fixedsticky.js'
],
dest: '_site/js/app.js'
}
},
sass: {
options: {
includePaths: [ config.node.path ],
precision: 6,
sourceComments: false,
sourceMap: true,
outputStyle: 'expanded'
},
dist: {
files: {
'_site/css/app.css': 'scss/app.scss'
}
}
},
// CSS build configuration
scsslint: {
options: {
bundleExec: true,
config: 'scss/.scss-lint.yml',
reporterOutput: null
},
core: {
src: ['scss/*.scss']
}
},
postcss: {
core: {
options: {
map: true,
processors: [
mq4HoverShim.postprocessorFor({ hoverSelectorPrefix: '.bs-true-hover ' }),
autoprefixer
]
},
src: '_site/css/*.css'
}
},
nunjucks: {
development: {
options: {data:{'env':'development'}},
files: [
{
expand: true,
cwd: "html/",
src: "*.html",
dest: "_site/",
ext: ".html"
}
]
},
production: {
options: {data:{'env':'development'}},
files: [
{
expand: true,
cwd: "html/",
src: "*.html",
dest: "_site/",
ext: ".html"
}
]
}
},
htmllint: {
options: {
ignore: [
'Element “img” is missing required attribute “src”.',
'Attribute “autocomplete” is only allowed when the input type is “color”, “date”, “datetime”, “datetime-local”, “email”, “month”, “number”, “password”, “range”, “search”, “tel”, “text”, “time”, “url”, or “week”.',
'Attribute “autocomplete” not allowed on element “button” at this point.',
'Element “div” not allowed as child of element “progress” in this context. (Suppressing further errors from this subtree.)',
'Consider using the “h1” element as a top-level heading only (all “h1” elements are treated as top-level headings by many screen readers and other tools).',
'The “color” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
'The “date” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
'The “datetime-local” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
'The “month” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
'The “time” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
'The “week” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.'
]
},
src: ['_site/**/*.html']
},
watch: {
sass: {
files: 'scss/**/*.scss',
tasks: ['compile-sass'],
options: {
livereload: true
}
},
html: {
files: 'html/**/*.html',
tasks: ['compile-html'],
options: {
livereload: true
}
}
},
connect: {
server: {
options: {
base: '_site',
port: 8080,
livereload: true
}
}
}
});
// These plugins provide necessary tasks.
require('load-grunt-tasks')(grunt, {});
require('time-grunt')(grunt);
grunt.registerTask('compile-html', ['nunjucks:development', 'htmllint']);
grunt.registerTask('compile-sass', ['sass', 'postcss']);
grunt.registerTask('server', ['connect', 'watch']);
// Default task.
grunt.registerTask('default', ['clean', 'concat', 'compile-sass', 'compile-html', 'server']);
};