-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
132 lines (126 loc) · 2.65 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
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'library/js/scripts.js',
'library/bootstrap/js/*.js'
]
},
less: {
dist: {
files: {
'library/dist/css/styles.min.css': [
'library/less/styles.less'
]
},
options: {
compress: true,
// LESS source map
// To enable, set sourceMap to true and update sourceMapRootpath based on your install
sourceMap: true,
sourceMapFilename: 'library/dist/css/styles.css.map',
sourceMapRootpath: '/wp-content/themes/meson-press/' // If you name your theme something different you may need to change this
}
}
},
uglify: {
dist: {
files: {
'library/dist/js/scripts.min.js': [
'library/js/*.js'
]
// Consider adding bootstrap js files here to consolidate your browser requests
},
options: {
// JS source map: to enable, uncomment the lines below and update sourceMappingURL based on your install
sourceMap: 'assets/js/scripts.min.js.map',
sourceMappingURL: '/app/themes/roots/assets/js/scripts.min.js.map'
}
}
},
grunticon: {
myIcons: {
files: [{
expand: true,
cwd: 'library/img',
src: ['*.svg', '*.png'],
dest: "library/img"
}],
options: {
}
}
},
version: {
assets: {
files: {
'functions.php': ['library/dist/css/styles.css', 'library/dist/js/scripts.min.js']
}
}
},
watch: {
less: {
files: [
'library/bootstrap/less/*.less',
'library/font-awesome/less/*.less',
'library/less/*.less'
],
tasks: ['less']
},
js: {
files: [
'<%= jshint.all %>'
],
tasks: ['uglify']
},
livereload: {
// Browser live reloading
// https://github.com/gruntjs/grunt-contrib-watch#live-reloading
options: {
livereload: true
},
files: [
'library/dist/css/styles.css',
'library/js/*',
'style.css',
'*.php'
]
}
},
clean: {
dist: [
'library/dist/css',
'library/dist/js'
]
}
});
// Load tasks
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-wp-assets');
grunt.loadNpmTasks('grunt-grunticon');
grunt.loadNpmTasks('grunt-svgstore');
// Register tasks
grunt.registerTask('default', [
'clean',
'less',
'uglify',
'grunticon'
]);
grunt.registerTask('build', [
'clean:dist',
'less',
'uglify',
'grunticon'
]);
grunt.registerTask('dev', [
'grunticon',
'watch'
]);
};