This repository has been archived by the owner on May 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
executable file
·142 lines (138 loc) · 3.72 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
/**
* @file
*/
module.exports = function(grunt) {
// This is where we configure each task that we'd like to run.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
// This is where we set up all the tasks we'd like grunt to watch for changes.
images: {
files: ['**/*.{png,jpg,gif}'],
tasks: ['imagemin'],
options: {
spawn: false,
}
},
vector: {
files: ['**/*.svg'],
tasks: ['svgmin'],
options: {
spawn: false,
}
},
css: {
files: ['**/*.scss'],
tasks: ['sass'],
options: {
interrupt: true
}
},
twig: {
files: ['**/*.html.twig'],
tasks: ['svgmin', 'imagemin', 'sass', 'drush:ccall']
}
},
imagemin: {
// This will optimize all of our images for the web.
dynamic: {
files: [{
expand: true,
cwd: 'img/source/',
src: ['{,*/}*.{png,jpg,gif}' ],
dest: 'img/optimized/'
}]
}
},
svgmin: {
options: {
plugins: [{
removeViewBox: false
}, {
removeUselessStrokeAndFill: false
}]
},
dist: {
files: [{
expand: true,
cwd: 'img/source/',
src: ['{,*/}*.svg' ],
dest: 'img/optimized/'
}]
}
},
sass: {
// This will compile all of our sass files
// Additional configuration options can be found at https://github.com/sindresorhus/grunt-sass
options: {
includePaths: [
"node_modules/bourbon/core",
"node_modules/bourbon-neat/core",
"node_modules/neat-omega",
"node_modules"
],
sourceMap: true,
// This controls the compiled css and can be changed to nested, compact or compressed.
outputStyle: 'expanded',
precision: 10
},
dist: {
files: {
// Compiled styles.
'css/hs_events.css': 'scss/hs_events.scss'
}
}
},
drush: {
ccall: {
args: ['cache-rebuild', 'all']
}
},
browserSync: {
dev: {
bsFiles: {
src : [
'css/**/*.css',
'templates/**/*.twig',
'img/optimized/**/*.{png,jpg,gif,svg}',
'js/build/**/*.js',
'*.theme'
]
},
options: {
watchTask: true,
// reloadDelay: 1000,
// reloadDebounce: 500,
reloadOnRestart: true,
logConnections: true,
injectChanges: false // Depends on enabling the link_css module
}
}
},
availabletasks: {
tasks: {
options: {
filter: "include",
tasks: [
'browserSync', 'imagemin', 'sass', 'svgmin', 'watch', 'devmode'
]
}
}
}
});
// This is where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-svgmin');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.loadNpmTasks('grunt-available-tasks');
grunt.loadNpmTasks('grunt-drush');
// My tasks.
grunt.registerTask('devmode', "Watch and BrowserSync all in one.", ['browserSync', 'watch']);
// This is where we tell Grunt what to do when we type "grunt" into the terminal.
// Note: if you'd like to run and of the tasks individually you can do so by typing 'grunt mytaskname' alternatively
// you can type 'grunt watch' to automatically track your files for changes.
grunt.registerTask('default', ['availabletasks']);
};