diff --git Gruntfile.js Gruntfile.js
index 0dc8b7f..2696c98 100644
|
|
|
module.exports = function(grunt) { |
| 12 | 12 | BANNER_TEXT = '/*! This file is auto-generated */', |
| 13 | 13 | autoprefixer = require( 'autoprefixer' ), |
| 14 | 14 | phpUnitWatchGroup = grunt.option( 'group' ), |
| | 15 | themeFiles = [ |
| | 16 | 'wp-content/themes/index.php', |
| | 17 | 'wp-content/themes/twenty*/**' |
| | 18 | ], |
| 15 | 19 | buildFiles = [ |
| 16 | 20 | '*.php', |
| 17 | 21 | '*.txt', |
| … |
… |
module.exports = function(grunt) { |
| 19 | 23 | 'wp-includes/**', // Include everything in wp-includes. |
| 20 | 24 | 'wp-admin/**', // Include everything in wp-admin. |
| 21 | 25 | 'wp-content/index.php', |
| 22 | | 'wp-content/themes/index.php', |
| 23 | | 'wp-content/themes/twenty*/**', |
| 24 | 26 | 'wp-content/plugins/index.php', |
| 25 | 27 | 'wp-content/plugins/hello.php', |
| 26 | 28 | 'wp-content/plugins/akismet/**' |
| 27 | | ], |
| 28 | | cleanFiles = []; |
| 29 | | |
| 30 | | buildFiles.forEach( function( buildFile ) { |
| 31 | | cleanFiles.push( BUILD_DIR + buildFile ); |
| 32 | | } ); |
| | 29 | ].concat( themeFiles ), |
| | 30 | cleanFiles = [ |
| | 31 | 'build/*.php', |
| | 32 | 'build/*.txt', |
| | 33 | 'build/*.html', |
| | 34 | 'build/wp-includes/**', // Include everything in wp-includes. |
| | 35 | 'build/wp-admin/**', // Include everything in wp-admin. |
| | 36 | 'build/wp-content' |
| | 37 | ]; |
| 33 | 38 | |
| 34 | 39 | if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] && ! phpUnitWatchGroup ) { |
| 35 | 40 | grunt.log.writeln(); |
| … |
… |
module.exports = function(grunt) { |
| 124 | 129 | ] |
| 125 | 130 | } |
| 126 | 131 | }, |
| | 132 | symlink: { |
| | 133 | expanded: { |
| | 134 | files: [ |
| | 135 | { |
| | 136 | expand: true, |
| | 137 | overwrite: true, |
| | 138 | cwd: SOURCE_DIR, |
| | 139 | src: [ |
| | 140 | 'wp-admin/*', |
| | 141 | 'wp-content/*', |
| | 142 | 'wp-includes/*', |
| | 143 | '*.php', |
| | 144 | '*.txt', |
| | 145 | '*.html', |
| | 146 | '!wp-admin/css', |
| | 147 | '!wp-content/themes', |
| | 148 | '!wp-includes/css', |
| | 149 | '!wp-includes/version.php', // Exclude version.php |
| | 150 | '!wp-includes/formatting.php', // Exclude formatting.php |
| | 151 | '!wp-includes/embed.php', // Exclude formatting.php |
| | 152 | '!index.php', '!wp-admin/index.php', |
| | 153 | '!_index.php', '!wp-admin/_index.php' |
| | 154 | ], |
| | 155 | dest: BUILD_DIR |
| | 156 | }, |
| | 157 | { |
| | 158 | 'build/wp-config-sample.php': ['wp-config-sample.php'], |
| | 159 | 'build/index.php': ['src/_index.php'], |
| | 160 | 'build/wp-admin/index.php': ['src/wp-admin/_index.php'] |
| | 161 | } |
| | 162 | ] |
| | 163 | } |
| | 164 | }, |
| 127 | 165 | copy: { |
| 128 | 166 | files: { |
| 129 | 167 | files: [ |
| … |
… |
module.exports = function(grunt) { |
| 135 | 173 | '!js/**', // JavaScript is extracted into separate copy tasks. |
| 136 | 174 | '!.{svn,git}', // Exclude version control folders. |
| 137 | 175 | '!wp-includes/version.php', // Exclude version.php |
| | 176 | '!wp-admin/css/**/*', // Exclude the CSS |
| | 177 | '!wp-includes/css/**/*', // Exclude the CSS |
| 138 | 178 | '!index.php', '!wp-admin/index.php', |
| 139 | 179 | '!_index.php', '!wp-admin/_index.php' |
| 140 | 180 | ] ), |
| … |
… |
module.exports = function(grunt) { |
| 150 | 190 | } |
| 151 | 191 | ] |
| 152 | 192 | }, |
| | 193 | css: { |
| | 194 | dot: true, |
| | 195 | expand: true, |
| | 196 | cwd: SOURCE_DIR, |
| | 197 | src: [ |
| | 198 | 'wp-admin/**/*.css', |
| | 199 | 'wp-includes/**/*.css' |
| | 200 | ], |
| | 201 | dest: BUILD_DIR |
| | 202 | }, |
| | 203 | themes: { |
| | 204 | dot: true, |
| | 205 | expand: true, |
| | 206 | cwd: SOURCE_DIR, |
| | 207 | src: themeFiles, |
| | 208 | dest: BUILD_DIR |
| | 209 | }, |
| 153 | 210 | 'npm-packages': { |
| 154 | 211 | files: { |
| 155 | 212 | 'build/wp-includes/js/backbone.js': ['./node_modules/backbone/backbone.js'], |
| … |
… |
module.exports = function(grunt) { |
| 338 | 395 | src: SOURCE_DIR + 'wp-includes/version.php', |
| 339 | 396 | dest: BUILD_DIR + 'wp-includes/version.php' |
| 340 | 397 | }, |
| | 398 | 'php-buildFiles': { |
| | 399 | files: { |
| | 400 | 'build/wp-includes/formatting.php': ['src/wp-includes/formatting.php'], |
| | 401 | 'build/wp-includes/embed.php': ['src/wp-includes/embed.php'], |
| | 402 | } |
| | 403 | }, |
| 341 | 404 | dynamic: { |
| 342 | 405 | dot: true, |
| 343 | 406 | expand: true, |
| … |
… |
module.exports = function(grunt) { |
| 1153 | 1216 | |
| 1154 | 1217 | grunt.registerTask( 'watch', function() { |
| 1155 | 1218 | if ( ! this.args.length || this.args.indexOf( 'webpack' ) > -1 ) { |
| 1156 | | grunt.task.run( 'build' ); |
| | 1219 | grunt.task.run( 'build:dev' ); |
| 1157 | 1220 | } |
| 1158 | 1221 | |
| 1159 | 1222 | if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] || 'undefined' !== typeof grunt.option( 'phpunit' ) ) { |
| … |
… |
module.exports = function(grunt) { |
| 1281 | 1344 | } |
| 1282 | 1345 | } ); |
| 1283 | 1346 | |
| | 1347 | grunt.registerTask( 'uglify:all', [ |
| | 1348 | 'uglify:core', |
| | 1349 | 'uglify:embed', |
| | 1350 | 'uglify:jqueryui', |
| | 1351 | 'uglify:imgareaselect' |
| | 1352 | ] ); |
| | 1353 | |
| 1284 | 1354 | grunt.registerTask( 'copy:js', [ |
| 1285 | 1355 | 'copy:npm-packages', |
| 1286 | 1356 | 'copy:vendor-js', |
| … |
… |
module.exports = function(grunt) { |
| 1288 | 1358 | 'copy:includes-js' |
| 1289 | 1359 | ] ); |
| 1290 | 1360 | |
| 1291 | | grunt.registerTask( 'uglify:all', [ |
| 1292 | | 'uglify:core', |
| 1293 | | 'uglify:embed', |
| 1294 | | 'uglify:jqueryui', |
| 1295 | | 'uglify:imgareaselect' |
| | 1361 | grunt.registerTask( 'copyOrSymlink', function() { |
| | 1362 | var task = grunt.option( 'symlink' ) === true ? 'symlink:expanded' : 'copy:files'; |
| | 1363 | grunt.task.run( task ); |
| | 1364 | } ); |
| | 1365 | |
| | 1366 | grunt.registerTask( 'copy:all', [ |
| | 1367 | 'copyOrSymlink', |
| | 1368 | 'copy:php-buildFiles', |
| | 1369 | 'copy:css', |
| | 1370 | 'copy:themes', |
| | 1371 | 'copy:wp-admin-css-compat-rtl', |
| | 1372 | 'copy:wp-admin-css-compat-min', |
| | 1373 | 'copy:version', |
| | 1374 | 'copy:js' |
| 1296 | 1375 | ] ); |
| 1297 | 1376 | |
| 1298 | 1377 | grunt.registerTask( 'build:tinymce', [ |
| … |
… |
module.exports = function(grunt) { |
| 1312 | 1391 | 'jsvalidate:build' |
| 1313 | 1392 | ] ); |
| 1314 | 1393 | |
| 1315 | | grunt.registerTask( 'copy:all', [ |
| 1316 | | 'copy:files', |
| 1317 | | 'copy:wp-admin-css-compat-rtl', |
| 1318 | | 'copy:wp-admin-css-compat-min', |
| 1319 | | 'copy:version', |
| 1320 | | 'copy:js' |
| 1321 | | ] ); |
| 1322 | | |
| 1323 | | grunt.registerTask( 'build', [ |
| | 1394 | grunt.registerTask( 'build:all', [ |
| 1324 | 1395 | 'clean:all', |
| 1325 | 1396 | 'webpack:dev', |
| 1326 | 1397 | 'copy:all', |
| … |
… |
module.exports = function(grunt) { |
| 1339 | 1410 | 'jsvalidate:build' |
| 1340 | 1411 | ] ); |
| 1341 | 1412 | |
| | 1413 | grunt.registerTask( 'build', function() { |
| | 1414 | grunt.task.run( 'build:all' ); |
| | 1415 | } ); |
| | 1416 | |
| | 1417 | grunt.registerTask( 'build:dev', function() { |
| | 1418 | try { |
| | 1419 | // Try creating a symlink. |
| | 1420 | fs.symlinkSync( './symlink', './symlinktest'); |
| | 1421 | grunt.option( 'symlink', true ); |
| | 1422 | // If succeeded, remove it again. |
| | 1423 | fs.unlinkSync( './symlinktest' ); |
| | 1424 | } catch( e ) { |
| | 1425 | console.warn( 'Error: failed to create a symlink on your system. Will use copy instead.' ) |
| | 1426 | grunt.verbose.write( 'The following error occurred:', e.message ); |
| | 1427 | } finally { |
| | 1428 | grunt.task.run( 'build:all' ); |
| | 1429 | } |
| | 1430 | } ); |
| | 1431 | |
| 1342 | 1432 | grunt.registerTask( 'prerelease', [ |
| 1343 | 1433 | 'precommit:php', |
| 1344 | 1434 | 'precommit:js', |
diff --git package-lock.json package-lock.json
index 3f81fc7..dfdb65d 100644
|
|
|
|
| 4976 | 4976 | "grunt-lib-phantomjs": "^1.0.0" |
| 4977 | 4977 | } |
| 4978 | 4978 | }, |
| | 4979 | "grunt-contrib-symlink": { |
| | 4980 | "version": "1.0.0", |
| | 4981 | "resolved": "https://registry.npmjs.org/grunt-contrib-symlink/-/grunt-contrib-symlink-1.0.0.tgz", |
| | 4982 | "integrity": "sha1-yDYWwDVxGmwAYqKBDPHHf/xr7Ss=", |
| | 4983 | "dev": true |
| | 4984 | }, |
| 4979 | 4985 | "grunt-contrib-uglify": { |
| 4980 | 4986 | "version": "2.0.0", |
| 4981 | 4987 | "resolved": "https://registry.npmjs.org/grunt-contrib-uglify/-/grunt-contrib-uglify-2.0.0.tgz", |
diff --git package.json package.json
index 06a5a5e..715d580 100644
|
|
|
|
| 25 | 25 | "grunt-contrib-imagemin": "~1.0.0", |
| 26 | 26 | "grunt-contrib-jshint": "~1.0.0", |
| 27 | 27 | "grunt-contrib-qunit": "^1.2.0", |
| | 28 | "grunt-contrib-symlink": "1.0.0", |
| 28 | 29 | "grunt-contrib-uglify": "~2.0.0", |
| 29 | 30 | "grunt-contrib-watch": "~1.0.0", |
| 30 | 31 | "grunt-file-append": "0.0.7", |