1+ module . exports = function ( grunt ) {
2+ // load all tasks
3+ require ( 'load-grunt-tasks' ) ( grunt , { scope : 'devDependencies' } ) ;
4+
5+ grunt . initConfig ( {
6+ pkg : grunt . file . readJSON ( 'package.json' ) ,
7+ checktextdomain : {
8+ standard : {
9+ options :{
10+ text_domain : [ 'fancybox-for-wordpress' ] , //Specify allowed domain(s)
11+ create_report_file : "true" ,
12+ keywords : [ //List keyword specifications
13+ '__:1,2d' ,
14+ '_e:1,2d' ,
15+ '_x:1,2c,3d' ,
16+ 'esc_html__:1,2d' ,
17+ 'esc_html_e:1,2d' ,
18+ 'esc_html_x:1,2c,3d' ,
19+ 'esc_attr__:1,2d' ,
20+ 'esc_attr_e:1,2d' ,
21+ 'esc_attr_x:1,2c,3d' ,
22+ '_ex:1,2c,3d' ,
23+ '_n:1,2,4d' ,
24+ '_nx:1,2,4c,5d' ,
25+ '_n_noop:1,2,3d' ,
26+ '_nx_noop:1,2,3c,4d'
27+ ]
28+ } ,
29+ files : [ {
30+ src : [
31+ '**/*.php' ,
32+ '!**/node_modules/**' ,
33+ ] , //all php
34+ expand : true ,
35+ } ] ,
36+ }
37+ } ,
38+ makepot : {
39+ target : {
40+ options : {
41+ cwd : '' , // Directory of files to internationalize.
42+ domainPath : 'languages/' , // Where to save the POT file.
43+ exclude : [ ] , // List of files or directories to ignore.
44+ include : [ ] , // List of files or directories to include.
45+ mainFile : 'fancybox.php' , // Main project file.
46+ potComments : '' , // The copyright at the beginning of the POT file.
47+ potFilename : 'fancybox-for-wordpress.po' , // Name of the POT file.
48+ potHeaders : {
49+ poedit : true , // Includes common Poedit headers.
50+ 'x-poedit-keywordslist' : true // Include a list of all possible gettext functions.
51+ } , // Headers to add to the generated POT file.
52+ processPot : null , // A callback function for manipulating the POT file.
53+ type : 'wp-plugin' , // Type of project (wp-plugin or wp-theme).
54+ updateTimestamp : true , // Whether the POT-Creation-Date should be updated without other changes.
55+ updatePoFiles : false // Whether to update PO files in the same directory as the POT file.
56+ }
57+ }
58+ } ,
59+ clean : {
60+ init : {
61+ src : [ 'build/' ]
62+ } ,
63+ build : {
64+ src : [
65+ 'build/*' ,
66+ '!build/<%= pkg.name %>.zip'
67+ ]
68+ }
69+ } ,
70+ copy : {
71+ build : {
72+ expand : true ,
73+ src : [
74+ '**' ,
75+ '!node_modules/**' ,
76+ '!vendor/**' ,
77+ '!build/**' ,
78+ '!readme.md' ,
79+ '!README.md' ,
80+ '!phpcs.ruleset.xml' ,
81+ '!Gruntfile.js' ,
82+ '!package.json' ,
83+ '!package-lock.json' ,
84+ '!composer.json' ,
85+ '!composer.lock' ,
86+ '!set_tags.sh' ,
87+ '!fancybox-for-wordpress.zip' ,
88+ '!nbproject/**' ] ,
89+ dest : 'build/'
90+ }
91+ } ,
92+ compress : {
93+ build : {
94+ options : {
95+ pretty : true , // Pretty print file sizes when logging.
96+ archive : '<%= pkg.name %>.zip'
97+ } ,
98+ expand : true ,
99+ cwd : 'build/' ,
100+ src : [ '**/*' ] ,
101+ dest : '<%= pkg.name %>/'
102+ }
103+ } ,
104+ } ) ;
105+
106+ grunt . registerTask ( 'i18n' , [ 'checktextdomain' , 'makepot' ] ) ;
107+ // Build task
108+ grunt . registerTask ( 'build-archive' , [
109+ // 'i18n',
110+ 'clean:init' ,
111+ 'copy' ,
112+ 'compress:build' ,
113+ 'clean:init'
114+ ] ) ;
115+ } ;
0 commit comments