diff --git Gruntfile.js Gruntfile.js
index 0dc8b7f..453c659 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 | | ], |
| | 29 | ].concat( themeFiles ), |
| 28 | 30 | cleanFiles = []; |
| 29 | 31 | |
| 30 | 32 | buildFiles.forEach( function( buildFile ) { |
| … |
… |
module.exports = function(grunt) {
|
| 124 | 126 | ] |
| 125 | 127 | } |
| 126 | 128 | }, |
| | 129 | symlink: { |
| | 130 | expanded: { |
| | 131 | files: [ |
| | 132 | { |
| | 133 | expand: true, |
| | 134 | overwrite: true, |
| | 135 | cwd: SOURCE_DIR, |
| | 136 | src: [ |
| | 137 | 'wp-admin/*', |
| | 138 | 'wp-content/uploads/', |
| | 139 | 'wp-content/index.php', |
| | 140 | 'wp-content/plugins/*', |
| | 141 | 'wp-includes/*', |
| | 142 | '*.php', |
| | 143 | '*.txt', |
| | 144 | '*.html', |
| | 145 | '!wp-load.php', |
| | 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 | 'build/wp-load.php': ['src/wp-load.php'], |
| | 403 | } |
| | 404 | }, |
| 341 | 405 | dynamic: { |
| 342 | 406 | dot: true, |
| 343 | 407 | expand: true, |
| … |
… |
module.exports = function(grunt) {
|
| 1153 | 1217 | |
| 1154 | 1218 | grunt.registerTask( 'watch', function() { |
| 1155 | 1219 | if ( ! this.args.length || this.args.indexOf( 'webpack' ) > -1 ) { |
| 1156 | | grunt.task.run( 'build' ); |
| | 1220 | grunt.task.run( 'build:dev' ); |
| 1157 | 1221 | } |
| 1158 | 1222 | |
| 1159 | 1223 | if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] || 'undefined' !== typeof grunt.option( 'phpunit' ) ) { |
| … |
… |
module.exports = function(grunt) {
|
| 1281 | 1345 | } |
| 1282 | 1346 | } ); |
| 1283 | 1347 | |
| | 1348 | grunt.registerTask( 'uglify:all', [ |
| | 1349 | 'uglify:core', |
| | 1350 | 'uglify:embed', |
| | 1351 | 'uglify:jqueryui', |
| | 1352 | 'uglify:imgareaselect' |
| | 1353 | ] ); |
| | 1354 | |
| 1284 | 1355 | grunt.registerTask( 'copy:js', [ |
| 1285 | 1356 | 'copy:npm-packages', |
| 1286 | 1357 | 'copy:vendor-js', |
| … |
… |
module.exports = function(grunt) {
|
| 1288 | 1359 | 'copy:includes-js' |
| 1289 | 1360 | ] ); |
| 1290 | 1361 | |
| 1291 | | grunt.registerTask( 'uglify:all', [ |
| 1292 | | 'uglify:core', |
| 1293 | | 'uglify:embed', |
| 1294 | | 'uglify:jqueryui', |
| 1295 | | 'uglify:imgareaselect' |
| | 1362 | grunt.registerTask( 'copyOrSymlink', function() { |
| | 1363 | var task = grunt.option( 'symlink' ) === true ? 'symlink:expanded' : 'copy:files'; |
| | 1364 | grunt.task.run( task ); |
| | 1365 | } ); |
| | 1366 | |
| | 1367 | grunt.registerTask( 'copy:all', [ |
| | 1368 | 'copyOrSymlink', |
| | 1369 | 'copy:php-buildFiles', |
| | 1370 | 'copy:css', |
| | 1371 | 'copy:themes', |
| | 1372 | 'copy:wp-admin-css-compat-rtl', |
| | 1373 | 'copy:wp-admin-css-compat-min', |
| | 1374 | 'copy:version', |
| | 1375 | 'copy:js' |
| 1296 | 1376 | ] ); |
| 1297 | 1377 | |
| 1298 | 1378 | grunt.registerTask( 'build:tinymce', [ |
| … |
… |
module.exports = function(grunt) {
|
| 1312 | 1392 | 'jsvalidate:build' |
| 1313 | 1393 | ] ); |
| 1314 | 1394 | |
| 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 | | ] ); |
| | 1395 | grunt.registerTask( 'clean-all', function() { |
| | 1396 | if ( grunt.option( 'symlink' ) === true ) { |
| | 1397 | // clean all symlinks |
| | 1398 | try { |
| | 1399 | var delSymlinks = require('del-symlinks'); |
| | 1400 | |
| | 1401 | var result = delSymlinks.sync(['./build/**']); |
| | 1402 | grunt.log.writeln( '>> ' + result.length + ' symlinks cleaned.' ); |
| | 1403 | } catch ( e ) { |
| | 1404 | grunt.verbose.error( 'Error:', e.message ); |
| | 1405 | grunt.fail.warn( "Failed to delete symlinks. If you're on Windows, " + |
| | 1406 | "running as administrator could resolve this issue."); |
| | 1407 | } |
| | 1408 | } |
| | 1409 | |
| | 1410 | grunt.task.run( 'clean:all' ); |
| | 1411 | } ); |
| 1322 | 1412 | |
| 1323 | | grunt.registerTask( 'build', [ |
| 1324 | | 'clean:all', |
| | 1413 | grunt.registerTask( 'build:all', [ |
| | 1414 | 'clean-all', |
| 1325 | 1415 | 'webpack:dev', |
| 1326 | 1416 | 'copy:all', |
| 1327 | 1417 | 'file_append', |
| … |
… |
module.exports = function(grunt) {
|
| 1339 | 1429 | 'jsvalidate:build' |
| 1340 | 1430 | ] ); |
| 1341 | 1431 | |
| | 1432 | grunt.registerTask( 'build', function() { |
| | 1433 | grunt.task.run( 'build:all' ); |
| | 1434 | } ); |
| | 1435 | |
| | 1436 | grunt.registerTask( 'build:dev', function() { |
| | 1437 | try { |
| | 1438 | // Try creating a symlink. |
| | 1439 | fs.symlinkSync( './symlink', './symlinktest'); |
| | 1440 | grunt.option( 'symlink', true ); |
| | 1441 | // If succeeded, remove it again. |
| | 1442 | fs.unlinkSync( './symlinktest' ); |
| | 1443 | } catch( e ) { |
| | 1444 | grunt.verbose.error( 'Error:', e.message ); |
| | 1445 | grunt.log.error( "Failed to delete symlinks. Falling back to copying " + |
| | 1446 | "files instead. If you're on Windows, " + |
| | 1447 | "running as administrator could resolve this issue."); |
| | 1448 | } finally { |
| | 1449 | grunt.task.run( 'build:all' ); |
| | 1450 | } |
| | 1451 | } ); |
| | 1452 | |
| 1342 | 1453 | grunt.registerTask( 'prerelease', [ |
| 1343 | 1454 | 'precommit:php', |
| 1344 | 1455 | 'precommit:js', |
diff --git package-lock.json package-lock.json
index 3f81fc7..9fdaee0 100644
|
|
|
|
| 2368 | 2368 | } |
| 2369 | 2369 | } |
| 2370 | 2370 | }, |
| | 2371 | "del-symlinks": { |
| | 2372 | "version": "0.1.2", |
| | 2373 | "resolved": "https://registry.npmjs.org/del-symlinks/-/del-symlinks-0.1.2.tgz", |
| | 2374 | "integrity": "sha1-rE/ePWow7Xk23QMH8APLtTUkP2U=", |
| | 2375 | "dev": true, |
| | 2376 | "requires": { |
| | 2377 | "get-symlinks": "^1.0.0", |
| | 2378 | "object-assign": "^4.1.0", |
| | 2379 | "pify": "^2.3.0", |
| | 2380 | "pinkie-promise": "^2.0.1" |
| | 2381 | } |
| | 2382 | }, |
| 2371 | 2383 | "delayed-stream": { |
| 2372 | 2384 | "version": "1.0.0", |
| 2373 | 2385 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", |
| … |
… |
|
| 4505 | 4517 | "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", |
| 4506 | 4518 | "dev": true |
| 4507 | 4519 | }, |
| | 4520 | "get-symlinks": { |
| | 4521 | "version": "1.0.2", |
| | 4522 | "resolved": "https://registry.npmjs.org/get-symlinks/-/get-symlinks-1.0.2.tgz", |
| | 4523 | "integrity": "sha1-sOYpxRHeGYGd08dskruNLi9CPGM=", |
| | 4524 | "dev": true, |
| | 4525 | "requires": { |
| | 4526 | "globby": "^6.0.0", |
| | 4527 | "is-symbolic-link": "^1.0.3", |
| | 4528 | "object-assign": "^4.1.0", |
| | 4529 | "pinkie-promise": "^2.0.1" |
| | 4530 | } |
| | 4531 | }, |
| 4508 | 4532 | "get-value": { |
| 4509 | 4533 | "version": "2.0.6", |
| 4510 | 4534 | "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", |
| … |
… |
|
| 4976 | 5000 | "grunt-lib-phantomjs": "^1.0.0" |
| 4977 | 5001 | } |
| 4978 | 5002 | }, |
| | 5003 | "grunt-contrib-symlink": { |
| | 5004 | "version": "1.0.0", |
| | 5005 | "resolved": "https://registry.npmjs.org/grunt-contrib-symlink/-/grunt-contrib-symlink-1.0.0.tgz", |
| | 5006 | "integrity": "sha1-yDYWwDVxGmwAYqKBDPHHf/xr7Ss=", |
| | 5007 | "dev": true |
| | 5008 | }, |
| 4979 | 5009 | "grunt-contrib-uglify": { |
| 4980 | 5010 | "version": "2.0.0", |
| 4981 | 5011 | "resolved": "https://registry.npmjs.org/grunt-contrib-uglify/-/grunt-contrib-uglify-2.0.0.tgz", |
| … |
… |
|
| 6414 | 6444 | "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", |
| 6415 | 6445 | "dev": true |
| 6416 | 6446 | }, |
| | 6447 | "is-symbolic-link": { |
| | 6448 | "version": "1.0.3", |
| | 6449 | "resolved": "https://registry.npmjs.org/is-symbolic-link/-/is-symbolic-link-1.0.3.tgz", |
| | 6450 | "integrity": "sha1-e9PWyeX+lONCpHRQRIcW8MJUOIM=", |
| | 6451 | "dev": true, |
| | 6452 | "requires": { |
| | 6453 | "pinkie-promise": "^2.0.1" |
| | 6454 | } |
| | 6455 | }, |
| 6417 | 6456 | "is-tar": { |
| 6418 | 6457 | "version": "1.0.0", |
| 6419 | 6458 | "resolved": "https://registry.npmjs.org/is-tar/-/is-tar-1.0.0.tgz", |
diff --git package.json package.json
index 06a5a5e..c91331c 100644
|
|
|
|
| 15 | 15 | "devDependencies": { |
| 16 | 16 | "autoprefixer": "^6.5.1", |
| 17 | 17 | "check-node-version": "3.2.0", |
| | 18 | "del-symlinks": "0.1.2", |
| 18 | 19 | "grunt": "1.0.2", |
| 19 | 20 | "grunt-banner": "^0.6.0", |
| 20 | 21 | "grunt-contrib-clean": "~1.0.0", |
| … |
… |
|
| 25 | 26 | "grunt-contrib-imagemin": "~1.0.0", |
| 26 | 27 | "grunt-contrib-jshint": "~1.0.0", |
| 27 | 28 | "grunt-contrib-qunit": "^1.2.0", |
| | 29 | "grunt-contrib-symlink": "1.0.0", |
| 28 | 30 | "grunt-contrib-uglify": "~2.0.0", |
| 29 | 31 | "grunt-contrib-watch": "~1.0.0", |
| 30 | 32 | "grunt-file-append": "0.0.7", |