From 9bd950b6d15280c3f8622affefb0ca2f90e3f486 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sun, 6 Oct 2013 10:33:01 +0000 Subject: [PATCH] New grunt copy:version task that removes -src from $wp_version on build. props azaozz. fixes #25161. git-svn-id: https://develop.svn.wordpress.org/trunk@25693 602fd350-edb4-49c9-b593-d223f7449a82 --- Gruntfile.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ffc3190d39..a1018423ad 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -26,13 +26,17 @@ module.exports = function(grunt) { } }, copy: { - all: { + files: { files: [ { dot: true, expand: true, cwd: SOURCE_DIR, - src: ['**','!**/.{svn,git}/**'], // Ignore version control directories. + src: [ + '**', + '!**/.{svn,git}/**', // Ignore version control directories. + '!wp-includes/version.php' // Exclude version.php + ], dest: BUILD_DIR }, { @@ -41,6 +45,19 @@ module.exports = function(grunt) { } ] }, + version: { + options: { + processContent: function( src, filepath ) { + return src.replace( /^(\$wp_version.+?)-src';/m, "$1';" ); + } + }, + files: [ + { + src: SOURCE_DIR + 'wp-includes/version.php', + dest: BUILD_DIR + 'wp-includes/version.php' + } + ] + }, dynamic: { dot: true, expand: true, @@ -158,6 +175,11 @@ module.exports = function(grunt) { }); // Register tasks. + + // Copy task. + grunt.registerTask('copy:all', ['copy:files', 'copy:version']); + + // Build task. grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 'uglify:core', 'uglify:tinymce', 'concat:tinymce', 'compress:tinymce', 'clean:tinymce']);