forked from awesomemotive/one-click-demo-import
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
104 lines (92 loc) · 2.12 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
module.exports = function ( grunt ) {
// Auto-load the needed grunt tasks
// require('load-grunt-tasks')(grunt);
require( 'load-grunt-tasks' )( grunt, { pattern: ['grunt-*'] } );
var config = {
tmpdir: '.tmp/',
phpFileRegex: '[^/]+\.php$',
phpFileInSubfolderRegex: '.*?\.php$',
pluginSlug: 'one-click-demo-import',
};
// configuration
grunt.initConfig( {
pgk: grunt.file.readJSON( 'package.json' ),
config: config,
// https://github.com/gruntjs/grunt-contrib-copy
copy: {
// create new directory for deployment
build: {
expand: true,
dot: false,
dest: config.pluginSlug + '/',
src: [
'*.php',
'readme.txt',
'assets/**',
'inc/**',
'languages/**',
'vendor/**',
'views/**',
],
flatten: false
}
},
// https://www.npmjs.com/package/grunt-wp-i18n
makepot: {
plugin: {
options: {
domainPath: 'languages/',
include: [config.phpFileRegex, '^inc/'+config.phpFileInSubfolderRegex],
mainFile: 'one-click-demo-import.php',
potComments: 'Copyright (C) {year} ProteusThemes \n# This file is distributed under the GPL 2.0.',
potFilename: 'pt-ocdi.pot',
potHeaders: {
poedit: true,
'report-msgid-bugs-to': 'http://support.proteusthemes.com/',
},
type: 'wp-plugin',
updateTimestamp: false,
updatePoFiles: true,
}
},
},
// https://www.npmjs.com/package/grunt-wp-i18n
addtextdomain: {
options: {
updateDomains: true
},
target: {
files: {
src: [
'*.php',
'inc/**/*.php',
]
}
}
},
// https://www.npmjs.com/package/grunt-po2mo
po2mo: {
files: {
src: 'languages/*.po',
expand: true,
},
},
wp_readme_to_markdown: {
your_target: {
files: {
'readme.md': 'readme.txt'
},
},
},
} );
// update languages files
grunt.registerTask( 'plugin_i18n', [
'addtextdomain',
'makepot:plugin',
'po2mo',
] );
// update languages files
grunt.registerTask( 'readme', [
'wp_readme_to_markdown',
] );
};