-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
129 lines (116 loc) · 3.74 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
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
// js minification
terser: {
dist: {
files: {
// admin scripts
'inc/js/yikes-theme-scripts.min.js': [ // theme specific scripts
'inc/js/navigation.js' , 'inc/js/skip-link-focus-fix.js' , 'inc/js/lwtv-theme-scripts.js' , 'inc/js/a11y.js', 'inc/js/searchbox.js'
],
'inc/js/customizer.min.js': [ // customizer specific script
'inc/js/customizer.js'
],
'inc/js/bootstrap-color-mode.min.js': [ // bootstrap color mode script
'inc/js/bootstrap-color-mode.js'
],
}
}
},
sass: { // Task
dist: { // Target
options: { // Target options
style: 'expanded'
},
files: { // Dictionary of files
'style.css': 'style.scss', // 'destination': 'source'
'style-editor.css' : 'style-editor.scss',
}
}
},
// css minify contents of our directory and add .min.css extension
cssmin: {
target: {
files: {
'style.min.css': ['style.css'],
'style-editor.min.css': ['style-editor.css']
}
}
},
// watch our project for changes
watch: {
admin_css: { // admin css
files: 'style.scss',
tasks: ['postcss','sass','cssmin'],
options: {
spawn:false,
event:['all']
},
},
sass_partials: { // sass partial mixins
files: 'partials/*.scss',
tasks: ['sass','cssmin'],
options: {
spawn:false,
event:['all']
},
},
editor_css: {
files: 'style-editor.scss',
tasks: ['postcss','sass','cssmin'],
options: {
spawn:false,
event:['all']
},
},
general_js: {
files: 'inc/js/*.js',
tasks: ['terser'],
options: {
spawn:false,
event:['all']
},
},
},
// Autoprefixer for our CSS files
postcss: {
options: {
map: true,
processors: require('autoprefixer')
},
dist: {
src: [ 'style*.css' ]
}
},
});
// load tasks
grunt.loadNpmTasks('grunt-terser');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('@lodder/grunt-postcss'); // CSS autoprefixer plugin (cross-browser auto pre-fixes)
// register task
grunt.registerTask('build', [
'terser',
'sass',
'cssmin',
'postcss',
]);
// register task
grunt.registerTask('watch', [
'terser',
'sass',
'cssmin',
'postcss',
'watch',
]);
// register task
grunt.registerTask('default', [
'terser',
'sass',
'cssmin',
'postcss',
'watch',
]);
};