diff --git a/Gruntfile.js b/Gruntfile.js index 32e56cc4cc..8afa3c7767 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -11,7 +11,25 @@ module.exports = function(grunt) { BUILD_DIR = 'build/', BANNER_TEXT = '/*! This file is auto-generated */', autoprefixer = require( 'autoprefixer' ), - phpUnitWatchGroup = grunt.option( 'group' ); + phpUnitWatchGroup = grunt.option( 'group' ), + buildFiles = [ + '*.php', + '*.txt', + '*.html', + 'wp-includes/**', // Include everything in wp-includes. + 'wp-admin/**', // Include everything in wp-admin. + 'wp-content/index.php', + 'wp-content/themes/index.php', + 'wp-content/themes/twenty*/**', + 'wp-content/plugins/index.php', + 'wp-content/plugins/hello.php', + 'wp-content/plugins/akismet/**' + ], + cleanFiles = []; + + buildFiles.forEach( function( buildFile ) { + cleanFiles.push( BUILD_DIR + buildFile ); + } ); if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] && ! phpUnitWatchGroup ) { grunt.log.writeln(); @@ -82,7 +100,9 @@ module.exports = function(grunt) { } }, clean: { - all: [BUILD_DIR], + plugins: [BUILD_DIR + 'wp-content/plugins'], + themes: [BUILD_DIR + 'wp-content/themes'], + all: cleanFiles, js: [BUILD_DIR + 'wp-admin/js/', BUILD_DIR + 'wp-includes/js/'], dynamic: { dot: true, @@ -111,14 +131,13 @@ module.exports = function(grunt) { dot: true, expand: true, cwd: SOURCE_DIR, - src: [ - '**', + src: buildFiles.concat( [ '!js/**', // JavaScript is extracted into separate copy tasks. - '!**/.{svn,git}/**', // Ignore version control directories. + '!.{svn,git}', // Exclude version control folders. '!wp-includes/version.php', // Exclude version.php '!index.php', '!wp-admin/index.php', '!_index.php', '!wp-admin/_index.php' - ], + ] ), dest: BUILD_DIR }, {