-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
111 lines (102 loc) · 2.4 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Project settings
project: {
dir: '',
assets: 'assets',
sass: 'sass'
},
// Start watching SASS
sass: {
dev: {
options: {
style: 'expanded',
lineNumbers: true,
sourcemap: false,
compass: false
},
files: [{
expand: true,
cwd: '<%= project.sass %>',
src: ['*.{sass,scss}'],
dest: '<%= project.dir %>',
ext: '.css'
}]
},
dist: {
options: {
style: 'compressed',
compass: false
},
files: [{
expand: true,
cwd: '<%= project.sass %>',
src: ['*.{sass,scss}'],
dest: '<%= project.sass %>/css/',
ext: '*.css'
}]
}
},
// Add in prefixes where necessary
autoprefixer: {
options: {
browsers: ['last 2 version', 'ie 9']
},
// prefix all files
multiple_files: {
expand: true,
flatten: true,
src: '<%= project.assets %>/css-source/raw/*.css',
dest: '<%= project.assets %>/css-source/prefix/'
},
},
// Combine Media Queries
cmq: {
your_target: {
files: {
'<%= project.dir %>': ['<%= project.assets %>/css-source/prefix/*.css']
}
}
},
// Set up watch commands for library
watch: {
sass: {
files: '<%= project.sass %>/*.{sass,scss}',
tasks: ['sass:dev'],
options: {
livereload: true
}
}
},
commit: {
sass: {
files: '<%= project.sass %>/*.{sass,scss}',
tasks: ['sass:dist'],
options: {
livereload: true
}
},
prefix: {
files: '<%= project.assets %>/css-source/raw/*.css',
tasks: ['autoprefixer']
},
combinemedia: {
files: '<%= project.assets %>/css-source/prefix/*.css',
tasks: ['cmq']
}
},
githooks: {
all: {
'pre-commit': 'watch'
}
}
});
// Load Tasks
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-combine-media-queries');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-githooks');
grunt.registerTask('default',['watch']);
}