-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
99 lines (90 loc) · 2.17 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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/**
* CSS post-processors
*
* autoprefixer-core adds support for older browsers by adding vendor
* prefixes to Sass properties, based on data from caniuse.com.
*/
postcss: {
options: {
processors: [
/**
* Add support for older browsers by adding vendor prefixes to
* Sass properties, based on data from caniuse.com.
*/
require('autoprefixer')( // add vendor prefixes
{
browsers: [
'last 3 Chrome versions',
'last 3 Safari versions',
'last 3 Firefox versions',
'last 3 iOS versions',
'last 1 Explorer versions',
'last 3 ChromeAndroid versions',
'last 6 Edge versions', // we can cut this back when we know better how users are updating
]
}
),
]
},
default_styles: {
src: 'styles.css',
dest: 'styles.css'
},
dev_styles: {
src: 'styles-dev.css',
dest: 'styles-dev.css'
},
},
/**
* Give hints on fixing bugs in JavaScript.
*/
jshint: {
Gruntfile: ['Gruntfile.js'],
},
/**
* Process Sass into CSS.
*/
sass: {
build: { // process specific files
options: {
style: 'compressed',
sourcemap: 'none'
},
files: [
{'styles.css': 'styles.scss'}, // 'destination': 'source'
]
},
dev: { // process specific files
options: {
lineNumbers: true,
style: 'expanded',
sourcemap: 'none'
},
files: [
{'styles-dev.css': 'styles.scss'}, // 'destination': 'source'
]
},
},
watch: {
gruntfile: { // Validate Gruntfile.
files: 'Gruntfile.js',
tasks: ['jshint'],
},
css: { // Autoprefix, then process Sass into CSS.
files: ['styles.scss', 'sass/**/*.scss'],
tasks: ['sass', 'postcss']
},
},
});
// Load the plugins.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-postcss');
// Default task(s).
grunt.registerTask('default', ['sass', 'postcss', 'jshint']);
};