-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGruntfile.js
More file actions
180 lines (166 loc) · 3.42 KB
/
Gruntfile.js
File metadata and controls
180 lines (166 loc) · 3.42 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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
module.exports = function( grunt ) {
'use strict';
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
copy: {
main: {
options: {
mode: true,
},
src: [
'**',
'!style - Copy.css',
'!resources/**',
'!node_modules/**',
'!css/sourcemap/**',
'!.git/**',
'!bin/**',
'!.gitlab-ci.yml',
'!tests/**',
'!phpunit.xml.dist',
'!*.sh',
'!*.map',
'!.gitignore',
'!phpunit.xml',
'!README.md',
'!codesniffer.ruleset.xml',
'!vendor/**',
'!phpcs.xml.dist',
'!phpcs.xml',
'!CONTRIBUTING.md',
'!phpcs.ruleset.xml',
/**
* Are you developer? Then add below files.
*/
'!Gruntfile.js',
'!postcss.config.js',
'!webpack.config.js',
'!package.json',
'!package-lock.json',
'!composer.json',
'!composer.lock',
'!yarn.lock',
'!sass/**',
'!*.zip',
],
dest: 'elementify/',
},
},
compress: {
main: {
options: {
archive: 'elementify.zip',
mode: 'zip',
},
files: [
{
src: [ './elementify/**' ],
},
],
},
},
clean: {
main: [ 'elementify' ],
zip: [ 'elementify.zip' ],
},
makepot: {
target: {
options: {
domainPath: '/',
mainFile: 'elementify.php',
potFilename: 'languages/elementify.pot',
potHeaders: {
poedit: true,
'x-poedit-keywordslist': true,
'pot-creation-date': new Date().toISOString(), // Ensure this is correctly defined
'language-team': 'Your Team <team@example.com>', // Optional: Add language team
'report-msgid-bugs-to': 'https://example.com/support', // Optional: Add bug report URL
},
type: 'wp-theme',
updateTimestamp: true,
},
},
},
wp_readme_to_markdown: {
your_target: {
files: {
'README.md': 'readme.txt',
},
},
},
addtextdomain: {
options: {
textdomain: 'elementify',
},
target: {
files: {
src: [
'*.php',
'**/*.php',
'!node_modules/**',
'!php-tests/**',
'!bin/**',
],
},
},
},
/**
* Check textdomain
*/
checktextdomain: {
standard: {
options: {
text_domain: 'elementify', //Specify allowed domain(s)
keywords: [
//List keyword specifications
'__:1,2d',
'_e:1,2d',
'_x:1,2c,3d',
'esc_html__:1,2d',
'esc_html_e:1,2d',
'esc_html_x:1,2c,3d',
'esc_attr__:1,2d',
'esc_attr_e:1,2d',
'esc_attr_x:1,2c,3d',
'_ex:1,2c,3d',
'_n:1,2,4d',
'_nx:1,2,4c,5d',
'_n_noop:1,2,3d',
'_nx_noop:1,2,3c,4d',
],
},
files: [
{
src: [
'**/*.php', //all php
'!node_modules/**',
],
expand: true,
},
],
},
},
} );
/**
* Load Grunt Tasks
*/
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-compress' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-wp-i18n' );
grunt.loadNpmTasks( 'grunt-checktextdomain' );
/* Read File Generation task */
grunt.loadNpmTasks( 'grunt-wp-readme-to-markdown' );
// Generate Read me file
grunt.registerTask( 'readme', [ 'wp_readme_to_markdown' ] );
// i18n
grunt.registerTask( 'i18n', [ 'checktextdomain', 'addtextdomain', 'makepot' ] );
// Generate Release package
grunt.registerTask( 'release', [
'clean:zip',
'copy',
'compress',
'clean:main',
] );
grunt.util.linefeed = '\n';
};