-
Notifications
You must be signed in to change notification settings - Fork 9
/
Gruntfile.js
181 lines (162 loc) · 5.18 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
170
171
172
173
174
175
176
177
178
179
180
181
module.exports = function(grunt) {
grunt.registerTask('watch', [ 'watch' ]);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// concat
concat: {
main: {
options: {
separator: ';'
},
src: ['assets/js/src/**/*.js'],
dest: 'assets/js/<%= pkg.name %>.js'
}
},
// uglify
uglify: {
options: {
mangle: false
},
js: {
files: {
'assets/js/<%= pkg.name %>.min.js': ['assets/js/<%= pkg.name %>.js']
}
}
},
// Add banner to style.css
usebanner: {
addbanner: {
options: {
position: 'top',
banner: '/*\nTheme Name: <%= pkg.title %>\n' +
'Theme URI: <%= pkg.theme_uri %>\n' +
'Author: <%= pkg.author %>\n' +
'Author URI: <%= pkg.author_uri %>\n' +
'Description: <%= pkg.description %>\n' +
'Version: <%= pkg.version %>\n' +
'License: GNU General Public License\n' +
'License URI: license.txt\n' +
'Text Domain: <%= pkg.text_domain %>\n' +
'*/',
linebreak: true
},
files: {
src: [ 'style.css', 'style.min.css' ]
}
}
},
// LESS CSS
less: {
style: {
files: {
"style.css": "assets/less/style.less",
"assets/css/affiliatewp.css": "assets/less/compatibility/affiliatewp.less",
"assets/css/edd-fes.css": "assets/less/compatibility/edd-fes.less",
"assets/css/edd-reviews.css": "assets/less/compatibility/edd-reviews.less",
"assets/css/edd-points-and-rewards.css": "assets/less/compatibility/edd-points-and-rewards.less",
}
},
minify: {
options: {
compress: true
},
files: {
"style.min.css": "assets/less/style.less",
"assets/css/affiliatewp.min.css": "assets/less/compatibility/affiliatewp.less",
"assets/css/edd-fes.min.css": "assets/less/compatibility/edd-fes.less",
"assets/css/edd-reviews.min.css": "assets/less/compatibility/edd-reviews.less",
"assets/css/edd-points-and-rewards.min.css": "assets/less/compatibility/edd-points-and-rewards.less"
}
}
},
// Autoprefixer
autoprefixer: {
main: {
files:{
'style.css': 'style.css',
'style.min.css': 'style.min.css',
'assets/css/affiliatewp.css': 'assets/css/affiliatewp.css',
'assets/css/affiliatewp.min.css': 'assets/css/affiliatewp.min.css',
'assets/css/edd-fes.css': 'assets/css/edd-fes.css',
'assets/css/edd-fes.min.css': 'assets/css/edd-fes.min.css',
"assets/css/edd-reviews.css": 'assets/css/edd-reviews.css',
"assets/css/edd-reviews.min.css": 'assets/css/edd-reviews.min.css',
'assets/css/edd-points-and-rewards.css': 'assets/css/edd-points-and-rewards.css',
'assets/css/edd-points-and-rewards.min.css': 'assets/css/edd-points-and-rewards.min.css'
},
},
},
// SVG Store
svgstore: {
options: {
prefix : 'icon-', // This will prefix each <g> ID
svg : {
'xmlns:sketch' : 'http://www.bohemiancoding.com/sketch/ns',
'xmlns:dc': "http://purl.org/dc/elements/1.1/",
'xmlns:cc': "http://creativecommons.org/ns#",
'xmlns:rdf': "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
'xmlns:svg': "http://www.w3.org/2000/svg",
'xmlns': "http://www.w3.org/2000/svg",
'xmlns:sodipodi': "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",
'xmlns:inkscape': "http://www.inkscape.org/namespaces/inkscape"
}
},
default : {
files: {
// svgs in the combined folder will be combined into the svg-defs.svg file
// usage: <svg><use xlink:href="<?php echo get_stylesheet_directory_uri() . '/images/svg-defs.svg#icon-name-of-svg'; ?>"></use></svg>
'assets/images/svg-defs.svg': ['assets/images/svgs/combined/*.svg'],
}
}
},
// SVG min
svgmin: {
options: {
plugins: [
{ removeViewBox: false },
{ removeUselessStrokeAndFill: false }
]
},
dist: {
expand: true,
cwd: 'assets/images/svgs/original',
src: ['*.svg'],
dest: 'assets/images/svgs'
}
},
// watch our project for changes
watch: {
// JS
js: {
files: ['assets/js/src/**/*.js'],
tasks: ['concat:main', 'uglify:js']
},
// svgstore
svgstore: {
files: ['assets/images/svgs/combined/*.svg'],
tasks: ['svgstore:default']
},
// svgmin
svgmin: {
files: ['assets/images/svgs/original/*.svg'],
tasks: ['svgmin:dist']
},
// CSS
css: {
files: ['assets/less/**/*.less'],
tasks: ['less:style', 'less:minify', 'autoprefixer:main']
},
// Add banner
addbanner: {
files: ['assets/less/**/*.less', 'style.css', 'style.min.css'],
tasks: ['usebanner:addbanner'],
options: {
spawn: false
}
},
}
});
// Saves having to declare each dependency
require( "matchdep" ).filterDev( "grunt-*" ).forEach( grunt.loadNpmTasks );
grunt.registerTask('default', ['concat', 'uglify', 'less', 'autoprefixer', 'usebanner', 'svgstore', 'svgmin' ]);
};