|
1 | 1 | 'use strict'; |
2 | 2 | module.exports = function( grunt ) { |
3 | 3 |
|
4 | | - // Load all grunt tasks matching the `grunt-*` pattern |
5 | | - // Ref. https://npmjs.org/package/load-grunt-tasks |
6 | | - require( 'load-grunt-tasks' )( grunt ); |
| 4 | + // Load all grunt tasks matching the `grunt-*` pattern |
| 5 | + // Ref. https://npmjs.org/package/load-grunt-tasks |
| 6 | + require( 'load-grunt-tasks' )( grunt ); |
7 | 7 |
|
8 | | - grunt.initConfig( |
9 | | - { |
10 | | - // Watch for changes and trigger autoprefixer, cssmin and uglify |
11 | | - // Ref. https://www.npmjs.com/package/grunt-contrib-watch |
12 | | - watch: { |
13 | | - css: { |
14 | | - files: [ 'admin/css/rt-transcoder-admin.css' ], |
15 | | - tasks: [ 'autoprefixer', 'cssmin' ] |
16 | | - }, |
17 | | - js: { |
18 | | - files: [ '<%= uglify.backend.src %>' ], |
19 | | - tasks: [ 'uglify' ] |
20 | | - } |
21 | | - }, |
22 | | - // Minify CSS |
23 | | - // Ref. https://www.npmjs.com/package/grunt-contrib-cssmin |
24 | | - cssmin: { |
25 | | - options: { |
26 | | - style: 'compressed', |
27 | | - sourcemap: 'none' |
28 | | - }, |
29 | | - target: { |
30 | | - files: { |
31 | | - 'admin/css/rt-transcoder-admin.min.css': 'admin/css/rt-transcoder-admin.css', |
32 | | - 'admin/css/rt-transcoder-client.min.css': 'admin/css/rt-transcoder-client.css' |
33 | | - } |
34 | | - } |
35 | | - }, |
36 | | - // Autoprefixer - Parse CSS and add vendor-prefixed CSS properties using the Can I Use database. |
37 | | - // Ref. https://www.npmjs.com/package/grunt-autoprefixer |
38 | | - autoprefixer: { |
39 | | - dist: { |
40 | | - options: { |
41 | | - browsers: [ 'last 2 versions', 'ie 9', 'ie 10', 'ios 6', 'android 4' ], |
42 | | - expand: true, |
43 | | - flatten: true |
44 | | - }, |
45 | | - files: { |
46 | | - 'admin/css/rt-transcoder-admin.css': 'admin/css/rt-transcoder-admin.css', |
47 | | - 'admin/css/rt-transcoder-client.css': 'admin/css/rt-transcoder-client.css' |
48 | | - } |
49 | | - } |
50 | | - }, |
51 | | - // Uglify - Minify JavaScript files with UglifyJS |
52 | | - // Ref. https://npmjs.org/package/grunt-contrib-uglify |
53 | | - uglify: { |
54 | | - options: { |
55 | | - banner: '/*! \n * Transcoder Library \n * @package Transcoder \n */\n' |
56 | | - }, |
57 | | - backend: { |
58 | | - src: [ |
59 | | - 'admin/js/rt-transcoder-admin.js' |
60 | | - ], |
61 | | - dest: 'admin/js/rt-transcoder-admin.min.js' |
62 | | - }, |
63 | | - footer: { |
64 | | - src: [ |
65 | | - 'admin/js/rt-transcoder.js' |
66 | | - ], |
67 | | - dest: 'admin/js/rt-transcoder.min.js' |
68 | | - } |
69 | | - }, |
70 | | - // Checktextdomain - Checks gettext function calls for missing or incorrect text domain. |
71 | | - // Ref. https://www.npmjs.com/package/grunt-checktextdomain |
72 | | - checktextdomain: { |
73 | | - options: { |
74 | | - text_domain: 'transcoder', // Specify allowed domain(s) |
75 | | - keywords: [ // List keyword specifications |
76 | | - '__:1,2d', |
77 | | - '_e:1,2d', |
78 | | - '_x:1,2c,3d', |
79 | | - 'esc_html__:1,2d', |
80 | | - 'esc_html_e:1,2d', |
81 | | - 'esc_html_x:1,2c,3d', |
82 | | - 'esc_attr__:1,2d', |
83 | | - 'esc_attr_e:1,2d', |
84 | | - 'esc_attr_x:1,2c,3d', |
85 | | - '_ex:1,2c,3d', |
86 | | - '_n:1,2,4d', |
87 | | - '_nx:1,2,4c,5d', |
88 | | - '_n_noop:1,2,3d', |
89 | | - '_nx_noop:1,2,3c,4d' |
90 | | - ] |
91 | | - }, |
92 | | - target: { |
93 | | - files: [ { |
94 | | - src: [ |
95 | | - '*.php', |
96 | | - '**/*.php', |
97 | | - '!node_modules/**', |
98 | | - '!tests/**' |
99 | | - ], // All php |
100 | | - expand: true |
101 | | - } ] |
102 | | - } |
103 | | - }, |
104 | | - // Make POT file - Internationalize WordPress plugins. |
105 | | - // Ref. https://www.npmjs.com/package/grunt-wp-i18n |
106 | | - makepot: { |
107 | | - target: { |
108 | | - options: { |
109 | | - cwd: '.', // Directory of files to internationalize. |
110 | | - domainPath: 'languages/', // Where to save the POT file. |
111 | | - exclude: [ 'node_modules/*', '.phpintel/*' ], // List of files or directories to ignore. |
112 | | - mainFile: 'index.php', // Main project file. |
113 | | - potFilename: 'transcoder.pot', // Name of the POT file. |
114 | | - potHeaders: { // Headers to add to the generated POT file. |
115 | | - poedit: true, // Includes common Poedit headers. |
116 | | - 'Last-Translator': 'Transcoder <support@rtcamp.com>', |
117 | | - 'Language-Team': 'Transcoder <support@rtcamp.com>', |
118 | | - 'report-msgid-bugs-to': 'http://community.rtcamp.com/', |
119 | | - 'x-poedit-keywordslist': true // Include a list of all possible gettext functions. |
120 | | - }, |
121 | | - type: 'wp-plugin', // Type of project (wp-plugin or wp-theme). |
122 | | - updateTimestamp: true // Whether the POT-Creation-Date should be updated without other changes. |
123 | | - } |
124 | | - } |
125 | | - } |
| 8 | + grunt.initConfig( { |
| 9 | + // Watch for changes and trigger autoprefixer, cssmin and uglify |
| 10 | + // Ref. https://www.npmjs.com/package/grunt-contrib-watch |
| 11 | + watch: { |
| 12 | + css: { |
| 13 | + files: [ 'admin/css/rt-transcoder-admin.css' ], |
| 14 | + tasks: [ 'autoprefixer', 'cssmin' ] |
| 15 | + }, |
| 16 | + js: { |
| 17 | + files: [ '<%= uglify.backend.src %>' ], |
| 18 | + tasks: [ 'uglify' ] |
| 19 | + } |
| 20 | + }, |
| 21 | + // Minify CSS |
| 22 | + // Ref. https://www.npmjs.com/package/grunt-contrib-cssmin |
| 23 | + cssmin: { |
| 24 | + options: { |
| 25 | + style: 'compressed', |
| 26 | + sourcemap: 'none' |
| 27 | + }, |
| 28 | + target: { |
| 29 | + files: { |
| 30 | + 'admin/css/rt-transcoder-admin.min.css': 'admin/css/rt-transcoder-admin.css', |
| 31 | + 'admin/css/rt-transcoder-client.min.css': 'admin/css/rt-transcoder-client.css' |
| 32 | + } |
| 33 | + } |
| 34 | + }, |
| 35 | + // Autoprefixer - Parse CSS and add vendor-prefixed CSS properties using the Can I Use database. |
| 36 | + // Ref. https://www.npmjs.com/package/grunt-autoprefixer |
| 37 | + autoprefixer: { |
| 38 | + dist: { |
| 39 | + options: { |
| 40 | + browsers: [ 'last 2 versions', 'ie 9', 'ie 10', 'ios 6', 'android 4' ], |
| 41 | + expand: true, |
| 42 | + flatten: true |
| 43 | + }, |
| 44 | + files: { |
| 45 | + 'admin/css/rt-transcoder-admin.css': 'admin/css/rt-transcoder-admin.css', |
| 46 | + 'admin/css/rt-transcoder-client.css': 'admin/css/rt-transcoder-client.css' |
| 47 | + } |
| 48 | + } |
| 49 | + }, |
| 50 | + // Uglify - Minify JavaScript files with UglifyJS |
| 51 | + // Ref. https://npmjs.org/package/grunt-contrib-uglify |
| 52 | + uglify: { |
| 53 | + options: { |
| 54 | + banner: '/*! \n * Transcoder Library \n * @package Transcoder \n */\n' |
| 55 | + }, |
| 56 | + backend: { |
| 57 | + src: [ |
| 58 | + 'admin/js/rt-transcoder-admin.js' |
| 59 | + ], |
| 60 | + dest: 'admin/js/rt-transcoder-admin.min.js' |
| 61 | + }, |
| 62 | + footer: { |
| 63 | + src: [ |
| 64 | + 'admin/js/rt-transcoder.js' |
| 65 | + ], |
| 66 | + dest: 'admin/js/rt-transcoder.min.js' |
| 67 | + } |
| 68 | + }, |
| 69 | + // Checktextdomain - Checks gettext function calls for missing or incorrect text domain. |
| 70 | + // Ref. https://www.npmjs.com/package/grunt-checktextdomain |
| 71 | + checktextdomain: { |
| 72 | + options: { |
| 73 | + text_domain: 'transcoder', //Specify allowed domain(s) |
| 74 | + keywords: [ //List keyword specifications |
| 75 | + '__:1,2d', |
| 76 | + '_e:1,2d', |
| 77 | + '_x:1,2c,3d', |
| 78 | + 'esc_html__:1,2d', |
| 79 | + 'esc_html_e:1,2d', |
| 80 | + 'esc_html_x:1,2c,3d', |
| 81 | + 'esc_attr__:1,2d', |
| 82 | + 'esc_attr_e:1,2d', |
| 83 | + 'esc_attr_x:1,2c,3d', |
| 84 | + '_ex:1,2c,3d', |
| 85 | + '_n:1,2,4d', |
| 86 | + '_nx:1,2,4c,5d', |
| 87 | + '_n_noop:1,2,3d', |
| 88 | + '_nx_noop:1,2,3c,4d' |
| 89 | + ] |
| 90 | + }, |
| 91 | + target: { |
| 92 | + files: [ { |
| 93 | + src: [ |
| 94 | + '*.php', |
| 95 | + '**/*.php', |
| 96 | + '!node_modules/**', |
| 97 | + '!tests/**' |
| 98 | + ], //All php |
| 99 | + expand: true |
| 100 | + } ] |
| 101 | + } |
| 102 | + }, |
| 103 | + // Make POT file - Internationalize WordPress plugins. |
| 104 | + // Ref. https://www.npmjs.com/package/grunt-wp-i18n |
| 105 | + makepot: { |
| 106 | + target: { |
| 107 | + options: { |
| 108 | + cwd: '.', // Directory of files to internationalize. |
| 109 | + domainPath: 'languages/', // Where to save the POT file. |
| 110 | + exclude: [ 'node_modules/*', '.phpintel/*' ], // List of files or directories to ignore. |
| 111 | + mainFile: 'index.php', // Main project file. |
| 112 | + potFilename: 'transcoder.pot', // Name of the POT file. |
| 113 | + potHeaders: { // Headers to add to the generated POT file. |
| 114 | + poedit: true, // Includes common Poedit headers. |
| 115 | + 'Last-Translator': 'Transcoder <support@rtcamp.com>', |
| 116 | + 'Language-Team': 'Transcoder <support@rtcamp.com>', |
| 117 | + 'report-msgid-bugs-to': 'http://community.rtcamp.com/', |
| 118 | + 'x-poedit-keywordslist': true // Include a list of all possible gettext functions. |
| 119 | + }, |
| 120 | + type: 'wp-plugin', // Type of project (wp-plugin or wp-theme). |
| 121 | + updateTimestamp: true // Whether the POT-Creation-Date should be updated without other changes. |
| 122 | + } |
| 123 | + } |
| 124 | + } |
126 | 125 |
|
127 | | - } |
128 | | - ); |
129 | | - // Register task |
130 | | - grunt.registerTask( 'default', [ 'autoprefixer', 'cssmin', 'uglify', 'checktextdomain', 'makepot', 'watch' ] ); |
| 126 | + } ); |
| 127 | + // Register task |
| 128 | + grunt.registerTask( 'default', [ 'autoprefixer', 'cssmin', 'uglify', 'checktextdomain', 'makepot', 'watch' ] ); |
131 | 129 | }; |
0 commit comments