-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Gruntfile.js
130 lines (118 loc) · 2.59 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
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
less: {
wp_css: {
files: {
"assets/css/shared.css": "assets/less/shared.less",
"assets/css/front.css": "assets/less/front.less",
"assets/css/admin.css": "assets/less/admin.less",
},
},
},
concat: {
wp_css: {
files: {
"assets/css/front.css": [
"assets/css/shared.css",
"assets/css/front.css",
],
"assets/css/admin.css": [
"assets/css/shared.css",
"assets/css/admin.css",
],
},
},
wp_js: {
files: {
"assets/js/front.min.js": [
"assets/js/shared.js",
"assets/js/front.js",
],
"assets/js/admin.min.js": [
"assets/js/shared.js",
"assets/js/admin.js",
],
},
},
},
terser: {
wp_js: {
files: {
"assets/js/front.min.js": ["assets/js/front.min.js"],
"assets/js/admin.min.js": ["assets/js/admin.min.js"],
},
},
},
cssmin: {
wp_css: {
files: {
"assets/css/front.min.css": "assets/css/front.css",
"assets/css/admin.min.css": "assets/css/admin.css",
},
},
},
watch: {
wp_css: {
files: ["assets/less/*.less"],
tasks: ["build_wp_css"],
},
wp_js: {
files: ["assets/js/*.js"],
tasks: ["build_wp_js"],
},
wp_readme: {
files: ["readme.txt"],
tasks: ["build_wp_md"],
},
},
wp_readme_to_markdown: {
build_wp_md: {
files: {
"readme.md": "readme.txt",
},
options: {
screenshot_url: "https://ps.w.org/{plugin}/assets/{screenshot}.jpg",
post_convert: function (content) {
//Remove unsupported Vimeo tags
return content.replace(/\[vimeo(.*)\]\n*/g, "");
},
},
},
},
makepot: {
target: {
options: {
domainPath: "languages/",
include: ["inc/.*"],
mainFile: "Waymark.php",
type: "wp-plugin",
updateTimestamp: false,
},
},
},
});
grunt.loadNpmTasks("grunt-terser");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-wp-readme-to-markdown");
grunt.loadNpmTasks("grunt-wp-i18n");
grunt.registerTask("default", [
"less",
"concat",
"terser",
"cssmin",
"makepot",
"wp_readme_to_markdown",
"watch",
]);
grunt.registerTask("build_wp_css", [
"less:wp_css",
"concat:wp_css",
"cssmin:wp_css",
]);
grunt.registerTask("build_wp_js", ["concat:wp_js", "terser:wp_js"]);
grunt.registerTask("build_wp_md", ["wp_readme_to_markdown:build_wp_md"]);
};