-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
120 lines (109 loc) · 3.13 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
module.exports = function(grunt) {
grunt.registerTask('watch', [ 'watch' ]);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// concat
concat: {
js: {
options: {
separator: ';'
},
src: ['js/src/**/*.js'],
dest: 'js/<%= pkg.name %>.min.js'
},
},
// uglify
uglify: {
options: {
mangle: false
},
js: {
files: {
'js/<%= pkg.name %>.min.js': ['js/<%= pkg.name %>.min.js']
}
}
},
// LESS CSS
less: {
style: {
options: {
compress: true
},
files: {
"style.css": "less/style.less",
"css/affiliatewp.min.css": "less/compatibility/affiliatewp.less"
}
}
},
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: {
'images/svg-defs.svg': ['svgs/*.svg'],
}
}
},
// Add banner to style.css
usebanner: {
addbanner: {
options: {
position: 'top',
banner: '/*\nTheme Name: Post Promoter Pro\n' +
'Template: <%= pkg.parentTheme %>\n' +
'Theme URI: https://postpromoterpro.com/\n' +
'Author: Andrew Munro\n' +
'Author URI: http://sumobi.com\n' +
'Description: \n' +
'License: GNU General Public License\n' +
'License URI: license.txt\n' +
'*/',
linebreak: true
},
files: {
src: [ 'style.css' ]
}
}
},
// watch our project for changes
watch: {
// JS
js: {
files: ['js/src/**/*.js'],
tasks: ['concat:js', 'uglify:js'],
},
svgstore: {
files: ['svgs/*.svg'],
tasks: ['svgstore:default']
},
// CSS
css: {
// compile CSS when any .less file is compiled in this theme and also the parent theme
files: ['less/*.less', '../<%= pkg.parentTheme %>/less/*.less'],
tasks: ['less:style'],
},
// Add banner
addbanner: {
files: 'style.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', 'svgstore', 'usebanner' ]);
};