-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGruntfile.js
More file actions
104 lines (97 loc) · 2.74 KB
/
Gruntfile.js
File metadata and controls
104 lines (97 loc) · 2.74 KB
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
module.exports = function(grunt) {
'use strict';
// Force use of Unix newlines
grunt.util.linefeed = '\n';
// Find what the current theme's directory is, relative to the WordPress root
var path = process.cwd();
path = path.replace(/^[\s\S]+\/wp-content/, "\/wp-content");
var CSS_LESS_FILES = {
'css/lroundups.css': 'less/lroundups.less',
'css/lroundups-admin.css': 'less/lroundups-admin.less',
'css/lroundups-editor.css': 'less/lroundups-editor.less'
};
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
development: {
options: {
paths: ['less'],
sourceMap: true,
outputSourceFiles: true,
sourceMapBasepath: path,
},
files: CSS_LESS_FILES
},
},
cssmin: {
target: {
options: {
report: 'gzip'
},
files: [{
expand: true,
cwd: 'css',
src: ['*.css', '!*.min.css'],
dest: 'css',
ext: '.min.css'
}]
}
},
uglify: {
target: {
options: {
report: 'gzip'
},
files: [{
expand: true,
cwd: 'js',
src: [
'links-common.js',
'lroundups-editor.js',
'lroundups.js',
'!*.min.js'
],
dest: 'js',
ext: '.min.js'
}]
}
},
watch: {
less: {
files: [
'less/**/*.less',
],
tasks: [
'less:development',
'uglify',
'cssmin'
]
},
},
shell: {
pot: {
command: [
'wp i18n make-pot . lang/link-roundups.pot --exclude="release"'
].join('&&'),
options: {
stdout: true
}
}
},
po2mo: {
files: {
src: 'lang/*.po',
expand: true
}
}
});
grunt.registerTask('pot', ['shell:pot']);
grunt.registerTask('build', 'build assets and language files', [
'less',
'cssmin',
'uglify',
'pot',
'po2mo'
]);
require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
}