2013-10-27 22:53:11 +01:00
|
|
|
/* jshint node:true */
|
2013-08-07 07:25:25 +02:00
|
|
|
module.exports = function(grunt) {
|
2013-10-27 22:53:11 +01:00
|
|
|
var path = require('path'),
|
|
|
|
SOURCE_DIR = 'src/',
|
2015-03-05 20:48:59 +01:00
|
|
|
BUILD_DIR = 'build/',
|
|
|
|
mediaConfig = {},
|
2015-04-14 17:30:16 +02:00
|
|
|
mediaBuilds = ['audiovideo', 'grid', 'models', 'views'];
|
2013-08-07 07:25:25 +02:00
|
|
|
|
2013-11-14 19:16:59 +01:00
|
|
|
// Load tasks.
|
2014-06-21 21:44:26 +02:00
|
|
|
require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks );
|
|
|
|
// Load legacy utils
|
|
|
|
grunt.util = require('grunt-legacy-util');
|
2013-09-04 22:50:29 +02:00
|
|
|
|
2015-03-05 20:48:59 +01:00
|
|
|
mediaBuilds.forEach( function ( build ) {
|
2015-04-14 17:30:16 +02:00
|
|
|
var path = SOURCE_DIR + 'wp-includes/js/media';
|
2015-03-05 20:48:59 +01:00
|
|
|
mediaConfig[ build ] = { files : {} };
|
2015-04-14 17:30:16 +02:00
|
|
|
mediaConfig[ build ].files[ path + '-' + build + '.js' ] = [ path + '/' + build + '.manifest.js' ];
|
2015-03-05 20:48:59 +01:00
|
|
|
} );
|
|
|
|
|
2013-08-07 07:25:25 +02:00
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
2014-02-13 09:29:16 +01:00
|
|
|
autoprefixer: {
|
|
|
|
options: {
|
2014-10-28 21:44:33 +01:00
|
|
|
browsers: ['Android >= 2.1', 'Chrome >= 21', 'Explorer >= 7', 'Firefox >= 17', 'Opera >= 12.1', 'Safari >= 6.0'],
|
|
|
|
cascade: false
|
2014-02-13 09:29:16 +01:00
|
|
|
},
|
|
|
|
core: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: SOURCE_DIR,
|
|
|
|
src: [
|
|
|
|
'wp-admin/css/*.css',
|
|
|
|
'wp-includes/css/*.css'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
colors: {
|
|
|
|
expand: true,
|
|
|
|
cwd: BUILD_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
src: [
|
|
|
|
'wp-admin/css/colors/*/colors.css'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2013-08-07 07:25:25 +02:00
|
|
|
clean: {
|
|
|
|
all: [BUILD_DIR],
|
|
|
|
dynamic: {
|
|
|
|
dot: true,
|
|
|
|
expand: true,
|
|
|
|
cwd: BUILD_DIR,
|
|
|
|
src: []
|
|
|
|
},
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
git-svn-id: https://develop.svn.wordpress.org/trunk@26876 602fd350-edb4-49c9-b593-d223f7449a82
2013-12-29 00:52:04 +01:00
|
|
|
tinymce: ['<%= concat.tinymce.dest %>'],
|
2013-11-09 21:43:58 +01:00
|
|
|
qunit: ['tests/qunit/compiled.html']
|
2013-08-07 07:25:25 +02:00
|
|
|
},
|
|
|
|
copy: {
|
2013-10-06 12:33:01 +02:00
|
|
|
files: {
|
2013-08-29 22:45:17 +02:00
|
|
|
files: [
|
|
|
|
{
|
|
|
|
dot: true,
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
2013-10-06 12:33:01 +02:00
|
|
|
src: [
|
|
|
|
'**',
|
2015-04-14 17:30:16 +02:00
|
|
|
'!wp-includes/js/media/**',
|
2013-10-06 12:33:01 +02:00
|
|
|
'!**/.{svn,git}/**', // Ignore version control directories.
|
Update Backbone from 1.0 to 1.1.
Also update Underscore to 1.6. Includes the development versions of both, which are not included in the build.
Here is Backbone's changelog:
* Made the return values of Collection’s `set`, `add`, `remove`, and `reset` more useful. Instead of returning `this`, they now return the changed (added, removed or updated) model or list of
models. (This means they can no longer be chained.)
* Backbone Views no longer automatically attach options passed to the constructor as `this.options` and Backbone Models no longer attach `url` and `urlRoot` options, but you can do it yourself if you prefer. (But if you extend `wp.Backbone.View`, options will be attached for you.)
* All `"invalid"` events now pass consistent arguments. First the model in question, then the error object, then options.
* You are no longer permitted to change the id of your model during `parse`. Use `idAttribute` instead.
* On the other hand, `parse` is now an excellent place to extract and vivify incoming nested JSON into associated submodels.
See [27171] (next commit) for changes made to WordPress to be compatible with Backbone 1.1.
props gcorne, georgestephanis.
see #26799.
git-svn-id: https://develop.svn.wordpress.org/trunk@27170 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-13 08:33:29 +01:00
|
|
|
// Ignore unminified versions of external libs we don't ship:
|
|
|
|
'!wp-includes/js/backbone.js',
|
|
|
|
'!wp-includes/js/underscore.js',
|
2014-03-04 03:19:41 +01:00
|
|
|
'!wp-includes/js/jquery/jquery.masonry.js',
|
2014-10-07 17:27:56 +02:00
|
|
|
'!wp-includes/js/jquery/ui/*.js',
|
2014-04-12 00:16:01 +02:00
|
|
|
'!wp-includes/js/tinymce/tinymce.js',
|
2013-12-07 07:00:34 +01:00
|
|
|
'!wp-includes/version.php' // Exclude version.php
|
2013-10-06 12:33:01 +02:00
|
|
|
],
|
2013-08-29 22:45:17 +02:00
|
|
|
dest: BUILD_DIR
|
|
|
|
},
|
|
|
|
{
|
|
|
|
src: 'wp-config-sample.php',
|
|
|
|
dest: BUILD_DIR
|
|
|
|
}
|
|
|
|
]
|
2013-08-07 07:25:25 +02:00
|
|
|
},
|
2014-02-19 22:42:36 +01:00
|
|
|
'wp-admin-rtl': {
|
|
|
|
options: {
|
|
|
|
processContent: function( src ) {
|
|
|
|
return src.replace( /\.css/g, '-rtl.css' );
|
|
|
|
}
|
|
|
|
},
|
|
|
|
src: SOURCE_DIR + 'wp-admin/css/wp-admin.css',
|
|
|
|
dest: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.css'
|
|
|
|
},
|
2013-10-06 12:33:01 +02:00
|
|
|
version: {
|
|
|
|
options: {
|
2013-10-27 22:53:11 +01:00
|
|
|
processContent: function( src ) {
|
2014-05-29 06:32:41 +02:00
|
|
|
return src.replace( /^\$wp_version = '(.+?)';/m, function( str, version ) {
|
|
|
|
version = version.replace( /-src$/, '' );
|
|
|
|
|
|
|
|
// If the version includes an SVN commit (-12345), it's not a released alpha/beta. Append a date.
|
|
|
|
version = version.replace( /-[\d]{5}$/, '-' + grunt.template.today( 'yyyymmdd' ) );
|
|
|
|
|
2014-05-29 21:33:00 +02:00
|
|
|
/* jshint quotmark: true */
|
2014-05-29 06:32:41 +02:00
|
|
|
return "$wp_version = '" + version + "';";
|
|
|
|
});
|
2013-10-06 12:33:01 +02:00
|
|
|
}
|
|
|
|
},
|
2014-02-19 22:42:36 +01:00
|
|
|
src: SOURCE_DIR + 'wp-includes/version.php',
|
|
|
|
dest: BUILD_DIR + 'wp-includes/version.php'
|
2013-10-06 12:33:01 +02:00
|
|
|
},
|
2013-08-07 07:25:25 +02:00
|
|
|
dynamic: {
|
|
|
|
dot: true,
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
src: []
|
2013-11-09 21:43:58 +01:00
|
|
|
},
|
2013-11-09 22:18:23 +01:00
|
|
|
qunit: {
|
2013-11-09 21:43:58 +01:00
|
|
|
src: 'tests/qunit/index.html',
|
|
|
|
dest: 'tests/qunit/compiled.html',
|
|
|
|
options: {
|
|
|
|
processContent: function( src ) {
|
2015-06-06 21:57:54 +02:00
|
|
|
return src.replace( /(\".+?\/)src(\/.+?)(?:.min)?(.js\")/g , function( match, $1, $2, $3 ) {
|
|
|
|
// Don't add `.min` to files that don't have it.
|
|
|
|
return $1 + 'build' + $2 + ( /jquery$/.test( $2 ) ? '' : '.min' ) + $3;
|
|
|
|
} );
|
2013-11-09 21:43:58 +01:00
|
|
|
}
|
|
|
|
}
|
2013-08-07 07:25:25 +02:00
|
|
|
}
|
|
|
|
},
|
2015-03-05 20:48:59 +01:00
|
|
|
browserify: mediaConfig,
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
git-svn-id: https://develop.svn.wordpress.org/trunk@26137 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-13 20:37:10 +01:00
|
|
|
sass: {
|
|
|
|
colors: {
|
2013-11-14 00:37:30 +01:00
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.css',
|
2013-12-03 22:13:14 +01:00
|
|
|
src: ['wp-admin/css/colors/*/colors.scss'],
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
git-svn-id: https://develop.svn.wordpress.org/trunk@26137 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-13 20:37:10 +01:00
|
|
|
options: {
|
2013-11-14 00:37:30 +01:00
|
|
|
outputStyle: 'expanded'
|
|
|
|
}
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
git-svn-id: https://develop.svn.wordpress.org/trunk@26137 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-13 20:37:10 +01:00
|
|
|
}
|
|
|
|
},
|
2013-08-07 07:25:25 +02:00
|
|
|
cssmin: {
|
2014-02-19 22:42:36 +01:00
|
|
|
options: {
|
Add menu management to the Customizer.
This brings in the Menu Customizer plugin: https://wordpress.org/plugins/menu-customizer/.
props celloexpressions, westonruter, valendesigns, voldemortensen, ocean90, adamsilverstein, kucrut, jorbin, designsimply, afercia, davidakennedy, obenland.
see #32576.
git-svn-id: https://develop.svn.wordpress.org/trunk@32806 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-17 00:07:08 +02:00
|
|
|
'wp-admin': ['wp-admin', 'color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'ie', 'install', 'login', 'press-this', 'deprecated-*']
|
2014-02-19 22:42:36 +01:00
|
|
|
},
|
2013-08-07 07:25:25 +02:00
|
|
|
core: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.min.css',
|
|
|
|
src: [
|
2014-02-19 22:42:36 +01:00
|
|
|
'wp-admin/css/{<%= cssmin.options["wp-admin"] %>}.css',
|
|
|
|
'wp-includes/css/*.css'
|
2013-08-07 07:25:25 +02:00
|
|
|
]
|
2013-11-12 22:18:45 +01:00
|
|
|
},
|
|
|
|
rtl: {
|
|
|
|
expand: true,
|
|
|
|
cwd: BUILD_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.min.css',
|
|
|
|
src: [
|
2014-02-19 22:42:36 +01:00
|
|
|
'wp-admin/css/{<%= cssmin.options["wp-admin"] %>}-rtl.css',
|
2013-11-12 22:18:45 +01:00
|
|
|
'wp-includes/css/*-rtl.css'
|
|
|
|
]
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
git-svn-id: https://develop.svn.wordpress.org/trunk@26137 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-13 20:37:10 +01:00
|
|
|
},
|
|
|
|
colors: {
|
|
|
|
expand: true,
|
|
|
|
cwd: BUILD_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.min.css',
|
|
|
|
src: [
|
2013-12-06 22:23:21 +01:00
|
|
|
'wp-admin/css/colors/*/*.css'
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
git-svn-id: https://develop.svn.wordpress.org/trunk@26137 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-13 20:37:10 +01:00
|
|
|
]
|
2013-11-12 22:18:45 +01:00
|
|
|
}
|
|
|
|
},
|
2015-02-27 14:40:03 +01:00
|
|
|
rtlcss: {
|
|
|
|
options: {
|
|
|
|
// rtlcss options
|
|
|
|
config: {
|
|
|
|
swapLeftRightInUrl: false,
|
2014-07-21 04:50:45 +02:00
|
|
|
swapLtrRtlInUrl: false,
|
2015-02-27 14:40:03 +01:00
|
|
|
autoRename: false,
|
|
|
|
preserveDirectives: true,
|
|
|
|
stringMap: [
|
|
|
|
{
|
|
|
|
name: 'import-rtl-stylesheet',
|
|
|
|
search: [ '.css' ],
|
|
|
|
replace: [ '-rtl.css' ],
|
|
|
|
options: {
|
|
|
|
scope: 'url',
|
|
|
|
ignoreCase: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2013-12-06 19:34:05 +01:00
|
|
|
},
|
2015-02-27 21:18:05 +01:00
|
|
|
properties : [
|
|
|
|
{
|
|
|
|
name: 'swap-dashicons-left-right-arrows',
|
|
|
|
expr: /content/im,
|
|
|
|
action: function( prop, value ) {
|
|
|
|
if ( value === '"\\f141"' ) { // dashicons-arrow-left
|
|
|
|
value = '"\\f139"';
|
|
|
|
} else if ( value === '"\\f340"' ) { // dashicons-arrow-left-alt
|
|
|
|
value = '"\\f344"';
|
|
|
|
} else if ( value === '"\\f341"' ) { // dashicons-arrow-left-alt2
|
|
|
|
value = '"\\f345"';
|
|
|
|
} else if ( value === '"\\f139"' ) { // dashicons-arrow-right
|
|
|
|
value = '"\\f141"';
|
|
|
|
} else if ( value === '"\\f344"' ) { // dashicons-arrow-right-alt
|
|
|
|
value = '"\\f340"';
|
|
|
|
} else if ( value === '"\\f345"' ) { // dashicons-arrow-right-alt2
|
|
|
|
value = '"\\f341"';
|
|
|
|
}
|
|
|
|
return { prop: prop, value: value };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2015-02-27 14:40:03 +01:00
|
|
|
saveUnmodified: false
|
|
|
|
},
|
|
|
|
core: {
|
2013-11-12 22:18:45 +01:00
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '-rtl.css',
|
|
|
|
src: [
|
|
|
|
'wp-admin/css/*.css',
|
2015-02-27 21:18:05 +01:00
|
|
|
'wp-includes/css/*.css',
|
|
|
|
|
|
|
|
// Exceptions
|
|
|
|
'!wp-includes/css/dashicons.css'
|
2013-11-12 22:18:45 +01:00
|
|
|
]
|
|
|
|
},
|
2013-12-04 18:21:01 +01:00
|
|
|
colors: {
|
|
|
|
expand: true,
|
|
|
|
cwd: BUILD_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '-rtl.css',
|
|
|
|
src: [
|
2013-12-06 22:23:21 +01:00
|
|
|
'wp-admin/css/colors/*/colors.css'
|
2013-12-04 18:21:01 +01:00
|
|
|
]
|
|
|
|
},
|
2013-11-12 22:18:45 +01:00
|
|
|
dynamic: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '-rtl.css',
|
|
|
|
src: []
|
2013-08-07 07:25:25 +02:00
|
|
|
}
|
|
|
|
},
|
2013-10-27 22:53:11 +01:00
|
|
|
jshint: {
|
|
|
|
options: grunt.file.readJSON('.jshintrc'),
|
|
|
|
grunt: {
|
2013-11-07 22:14:49 +01:00
|
|
|
src: ['Gruntfile.js']
|
2013-10-27 22:53:11 +01:00
|
|
|
},
|
|
|
|
tests: {
|
2013-11-07 22:14:49 +01:00
|
|
|
src: [
|
|
|
|
'tests/qunit/**/*.js',
|
2014-03-29 11:05:22 +01:00
|
|
|
'!tests/qunit/vendor/*',
|
2014-02-10 02:11:25 +01:00
|
|
|
'!tests/qunit/editor/**'
|
2013-11-07 22:14:49 +01:00
|
|
|
],
|
2013-10-27 22:53:11 +01:00
|
|
|
options: grunt.file.readJSON('tests/qunit/.jshintrc')
|
|
|
|
},
|
2013-11-13 00:41:17 +01:00
|
|
|
themes: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR + 'wp-content/themes',
|
|
|
|
src: [
|
2014-03-07 00:41:18 +01:00
|
|
|
'twenty*/**/*.js',
|
2013-11-13 00:41:17 +01:00
|
|
|
'!twenty{eleven,twelve,thirteen}/**',
|
|
|
|
// Third party scripts
|
2014-10-14 21:47:11 +02:00
|
|
|
'!twenty{fourteen,fifteen}/js/html5.js'
|
2013-11-13 00:41:17 +01:00
|
|
|
]
|
|
|
|
},
|
2015-02-09 17:00:44 +01:00
|
|
|
media: {
|
|
|
|
options: {
|
|
|
|
browserify: true
|
|
|
|
},
|
|
|
|
src: [
|
2015-04-14 17:30:16 +02:00
|
|
|
SOURCE_DIR + 'wp-includes/js/media/**/*.js'
|
2015-02-09 17:00:44 +01:00
|
|
|
]
|
|
|
|
},
|
2013-11-07 22:14:49 +01:00
|
|
|
core: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
src: [
|
|
|
|
'wp-admin/js/*.js',
|
|
|
|
'wp-includes/js/*.js',
|
2015-04-14 17:30:16 +02:00
|
|
|
// Built scripts.
|
|
|
|
'!wp-includes/js/media-*',
|
2013-11-07 22:14:49 +01:00
|
|
|
// WordPress scripts inside directories
|
|
|
|
'wp-includes/js/jquery/jquery.table-hotkeys.js',
|
|
|
|
'wp-includes/js/mediaelement/wp-mediaelement.js',
|
|
|
|
'wp-includes/js/plupload/handlers.js',
|
|
|
|
'wp-includes/js/plupload/wp-plupload.js',
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
git-svn-id: https://develop.svn.wordpress.org/trunk@26876 602fd350-edb4-49c9-b593-d223f7449a82
2013-12-29 00:52:04 +01:00
|
|
|
'wp-includes/js/tinymce/plugins/wordpress/plugin.js',
|
|
|
|
'wp-includes/js/tinymce/plugins/wp*/plugin.js',
|
2013-11-07 22:14:49 +01:00
|
|
|
// Third party scripts
|
|
|
|
'!wp-admin/js/farbtastic.js',
|
2014-02-13 09:58:17 +01:00
|
|
|
'!wp-includes/js/backbone*.js',
|
2013-11-07 22:14:49 +01:00
|
|
|
'!wp-includes/js/swfobject.js',
|
2014-02-13 09:58:17 +01:00
|
|
|
'!wp-includes/js/underscore*.js',
|
2013-11-07 22:14:49 +01:00
|
|
|
'!wp-includes/js/colorpicker.js',
|
|
|
|
'!wp-includes/js/hoverIntent.js',
|
|
|
|
'!wp-includes/js/json2.js',
|
2014-02-27 20:38:51 +01:00
|
|
|
'!wp-includes/js/tw-sack.js',
|
2015-03-12 13:51:06 +01:00
|
|
|
'!wp-includes/js/twemoji.js',
|
2014-02-27 20:38:51 +01:00
|
|
|
'!**/*.min.js'
|
2013-11-07 22:14:49 +01:00
|
|
|
],
|
|
|
|
// Remove once other JSHint errors are resolved
|
|
|
|
options: {
|
|
|
|
curly: false,
|
|
|
|
eqeqeq: false
|
2013-11-08 01:40:38 +01:00
|
|
|
},
|
2014-04-30 23:39:43 +02:00
|
|
|
// Limit JSHint's run to a single specified file:
|
|
|
|
//
|
|
|
|
// grunt jshint:core --file=filename.js
|
|
|
|
//
|
|
|
|
// Optionally, include the file path:
|
|
|
|
//
|
|
|
|
// grunt jshint:core --file=path/to/filename.js
|
|
|
|
//
|
2013-11-08 01:40:38 +01:00
|
|
|
filter: function( filepath ) {
|
2013-11-14 19:16:59 +01:00
|
|
|
var index, file = grunt.option( 'file' );
|
2013-11-08 01:40:38 +01:00
|
|
|
|
|
|
|
// Don't filter when no target file is specified
|
|
|
|
if ( ! file ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Normalize filepath for Windows
|
|
|
|
filepath = filepath.replace( /\\/g, '/' );
|
2013-11-14 19:16:59 +01:00
|
|
|
index = filepath.lastIndexOf( '/' + file );
|
2013-11-08 01:40:38 +01:00
|
|
|
|
|
|
|
// Match only the filename passed from cli
|
2013-11-14 19:16:59 +01:00
|
|
|
if ( filepath === file || ( -1 !== index && index === filepath.length - ( file.length + 1 ) ) ) {
|
2013-11-08 01:40:38 +01:00
|
|
|
return true;
|
2014-06-21 22:02:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
plugins: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR + 'wp-content/plugins',
|
|
|
|
src: [
|
|
|
|
'**/*.js',
|
|
|
|
'!**/*.min.js'
|
|
|
|
],
|
2014-06-24 02:07:00 +02:00
|
|
|
// Limit JSHint's run to a single specified plugin directory:
|
2014-06-21 22:02:47 +02:00
|
|
|
//
|
2014-06-24 02:07:00 +02:00
|
|
|
// grunt jshint:plugins --dir=foldername
|
2014-06-21 22:02:47 +02:00
|
|
|
//
|
2014-06-24 02:07:00 +02:00
|
|
|
filter: function( dirpath ) {
|
|
|
|
var index, dir = grunt.option( 'dir' );
|
2014-06-21 22:02:47 +02:00
|
|
|
|
|
|
|
// Don't filter when no target folder is specified
|
2014-06-24 02:07:00 +02:00
|
|
|
if ( ! dir ) {
|
2014-06-21 22:02:47 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-06-24 02:07:00 +02:00
|
|
|
dirpath = dirpath.replace( /\\/g, '/' );
|
|
|
|
index = dirpath.lastIndexOf( '/' + dir );
|
2014-06-21 22:02:47 +02:00
|
|
|
|
|
|
|
// Match only the folder name passed from cli
|
|
|
|
if ( -1 !== index ) {
|
|
|
|
return true;
|
2013-11-08 01:40:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2013-10-27 22:53:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2013-08-30 06:06:34 +02:00
|
|
|
qunit: {
|
2014-02-10 02:11:25 +01:00
|
|
|
files: [
|
|
|
|
'tests/qunit/**/*.html',
|
|
|
|
'!tests/qunit/editor/**'
|
|
|
|
]
|
2013-08-30 06:06:34 +02:00
|
|
|
},
|
2013-11-09 22:18:23 +01:00
|
|
|
phpunit: {
|
2013-11-09 22:25:02 +01:00
|
|
|
'default': {
|
2013-11-09 22:18:23 +01:00
|
|
|
cmd: 'phpunit',
|
|
|
|
args: ['-c', 'phpunit.xml.dist']
|
|
|
|
},
|
|
|
|
ajax: {
|
|
|
|
cmd: 'phpunit',
|
|
|
|
args: ['-c', 'phpunit.xml.dist', '--group', 'ajax']
|
|
|
|
},
|
|
|
|
multisite: {
|
|
|
|
cmd: 'phpunit',
|
|
|
|
args: ['-c', 'tests/phpunit/multisite.xml']
|
2014-11-10 15:48:28 +01:00
|
|
|
},
|
|
|
|
'external-http': {
|
|
|
|
cmd: 'phpunit',
|
|
|
|
args: ['-c', 'phpunit.xml.dist', '--group', 'external-http']
|
2013-11-09 22:18:23 +01:00
|
|
|
}
|
|
|
|
},
|
2013-08-07 07:25:25 +02:00
|
|
|
uglify: {
|
|
|
|
core: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.min.js',
|
|
|
|
src: [
|
|
|
|
'wp-admin/js/*.js',
|
|
|
|
'wp-includes/js/*.js',
|
|
|
|
'wp-includes/js/plupload/handlers.js',
|
|
|
|
'wp-includes/js/plupload/wp-plupload.js',
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
git-svn-id: https://develop.svn.wordpress.org/trunk@26876 602fd350-edb4-49c9-b593-d223f7449a82
2013-12-29 00:52:04 +01:00
|
|
|
'wp-includes/js/tinymce/plugins/wordpress/plugin.js',
|
|
|
|
'wp-includes/js/tinymce/plugins/wp*/plugin.js',
|
|
|
|
|
2013-08-07 07:25:25 +02:00
|
|
|
// Exceptions
|
2015-04-07 06:37:24 +02:00
|
|
|
'!wp-admin/js/bookmarklet.*', // Minified and updated in /src with the precommit task. See uglify:bookmarklet.
|
2013-08-07 07:25:25 +02:00
|
|
|
'!wp-admin/js/custom-header.js', // Why? We should minify this.
|
|
|
|
'!wp-admin/js/farbtastic.js',
|
|
|
|
'!wp-admin/js/iris.min.js',
|
2015-04-07 06:37:24 +02:00
|
|
|
'!wp-includes/js/backbone.*',
|
|
|
|
'!wp-includes/js/masonry.min.js',
|
2013-08-07 07:25:25 +02:00
|
|
|
'!wp-includes/js/swfobject.js',
|
2015-04-07 06:37:24 +02:00
|
|
|
'!wp-includes/js/underscore.*',
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
git-svn-id: https://develop.svn.wordpress.org/trunk@26876 602fd350-edb4-49c9-b593-d223f7449a82
2013-12-29 00:52:04 +01:00
|
|
|
'!wp-includes/js/zxcvbn.min.js'
|
2013-08-07 07:25:25 +02:00
|
|
|
]
|
2014-10-07 17:27:56 +02:00
|
|
|
},
|
2015-02-09 01:42:28 +01:00
|
|
|
media: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.min.js',
|
|
|
|
src: [
|
|
|
|
'wp-includes/js/media/audio-video.js',
|
|
|
|
'wp-includes/js/media/grid.js',
|
|
|
|
'wp-includes/js/media/models.js',
|
|
|
|
'wp-includes/js/media/views.js'
|
|
|
|
]
|
|
|
|
},
|
2014-10-07 17:27:56 +02:00
|
|
|
jqueryui: {
|
|
|
|
options: {
|
|
|
|
preserveComments: 'some'
|
|
|
|
},
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.min.js',
|
|
|
|
src: ['wp-includes/js/jquery/ui/*.js']
|
2015-02-25 21:15:46 +01:00
|
|
|
},
|
|
|
|
bookmarklet: {
|
|
|
|
options: {
|
|
|
|
compress: {
|
|
|
|
negate_iife: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
src: SOURCE_DIR + 'wp-admin/js/bookmarklet.js',
|
|
|
|
dest: SOURCE_DIR + 'wp-admin/js/bookmarklet.min.js'
|
2013-08-07 07:25:25 +02:00
|
|
|
}
|
|
|
|
},
|
2013-08-31 00:16:43 +02:00
|
|
|
concat: {
|
|
|
|
tinymce: {
|
|
|
|
options: {
|
|
|
|
separator: '\n',
|
|
|
|
process: function( src, filepath ) {
|
|
|
|
return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
src: [
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
git-svn-id: https://develop.svn.wordpress.org/trunk@26876 602fd350-edb4-49c9-b593-d223f7449a82
2013-12-29 00:52:04 +01:00
|
|
|
BUILD_DIR + 'wp-includes/js/tinymce/tinymce.min.js',
|
|
|
|
BUILD_DIR + 'wp-includes/js/tinymce/themes/modern/theme.min.js',
|
|
|
|
BUILD_DIR + 'wp-includes/js/tinymce/plugins/*/plugin.min.js'
|
2013-08-31 00:16:43 +02:00
|
|
|
],
|
|
|
|
dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js'
|
2015-03-25 00:32:23 +01:00
|
|
|
},
|
|
|
|
emoji: {
|
|
|
|
options: {
|
|
|
|
separator: '\n',
|
|
|
|
process: function( src, filepath ) {
|
|
|
|
return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
src: [
|
|
|
|
BUILD_DIR + 'wp-includes/js/twemoji.min.js',
|
|
|
|
BUILD_DIR + 'wp-includes/js/wp-emoji.min.js'
|
|
|
|
],
|
|
|
|
dest: BUILD_DIR + 'wp-includes/js/wp-emoji-release.min.js'
|
2013-08-31 00:16:43 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
compress: {
|
|
|
|
tinymce: {
|
|
|
|
options: {
|
|
|
|
mode: 'gzip',
|
|
|
|
level: 9
|
|
|
|
},
|
|
|
|
src: '<%= concat.tinymce.dest %>',
|
|
|
|
dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz'
|
|
|
|
}
|
|
|
|
},
|
2014-01-17 19:14:15 +01:00
|
|
|
jsvalidate:{
|
2014-02-13 09:00:47 +01:00
|
|
|
options: {
|
2014-01-17 19:14:15 +01:00
|
|
|
globals: {},
|
|
|
|
esprimaOptions:{},
|
|
|
|
verbose: false
|
|
|
|
},
|
|
|
|
build: {
|
|
|
|
files: {
|
2014-01-29 05:44:31 +01:00
|
|
|
src: [
|
2014-10-17 22:37:07 +02:00
|
|
|
BUILD_DIR + 'wp-{admin,includes}/**/*.js',
|
|
|
|
BUILD_DIR + 'wp-content/themes/twenty*/**/*.js'
|
2014-01-29 05:44:31 +01:00
|
|
|
]
|
2014-01-17 19:14:15 +01:00
|
|
|
}
|
2014-01-29 05:44:31 +01:00
|
|
|
}
|
2014-01-17 19:14:15 +01:00
|
|
|
},
|
2014-02-13 09:00:47 +01:00
|
|
|
imagemin: {
|
|
|
|
core: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
src: [
|
|
|
|
'wp-{admin,includes}/images/**/*.{png,jpg,gif,jpeg}',
|
|
|
|
'wp-includes/js/tinymce/skins/wordpress/images/*.{png,jpg,gif,jpeg}'
|
|
|
|
],
|
|
|
|
dest: SOURCE_DIR
|
|
|
|
}
|
|
|
|
},
|
2015-03-25 00:32:23 +01:00
|
|
|
includes: {
|
|
|
|
emoji: {
|
|
|
|
src: BUILD_DIR + 'wp-includes/formatting.php',
|
|
|
|
dest: '.'
|
|
|
|
}
|
|
|
|
},
|
2015-03-05 20:48:59 +01:00
|
|
|
_watch: {
|
2013-08-07 07:25:25 +02:00
|
|
|
all: {
|
|
|
|
files: [
|
|
|
|
SOURCE_DIR + '**',
|
|
|
|
// Ignore version control directories.
|
|
|
|
'!' + SOURCE_DIR + '**/.{svn,git}/**'
|
|
|
|
],
|
|
|
|
tasks: ['clean:dynamic', 'copy:dynamic'],
|
|
|
|
options: {
|
|
|
|
dot: true,
|
|
|
|
spawn: false,
|
|
|
|
interval: 2000
|
|
|
|
}
|
2013-08-30 06:06:34 +02:00
|
|
|
},
|
2015-02-09 01:42:28 +01:00
|
|
|
browserify: {
|
|
|
|
files: [
|
2015-03-05 20:48:59 +01:00
|
|
|
SOURCE_DIR + 'wp-includes/js/media/*.js',
|
|
|
|
'!' + SOURCE_DIR + 'wp-includes/js/media/*.manifest.js'
|
2015-02-09 01:42:28 +01:00
|
|
|
],
|
2015-03-05 20:48:59 +01:00
|
|
|
tasks: ['uglify:media']
|
2015-02-09 01:42:28 +01:00
|
|
|
},
|
2014-09-29 19:20:58 +02:00
|
|
|
config: {
|
|
|
|
files: 'Gruntfile.js'
|
|
|
|
},
|
2013-11-14 00:37:30 +01:00
|
|
|
colors: {
|
2013-12-03 22:13:14 +01:00
|
|
|
files: [SOURCE_DIR + 'wp-admin/css/colors/**'],
|
2013-11-14 00:37:30 +01:00
|
|
|
tasks: ['sass:colors']
|
|
|
|
},
|
2013-11-12 22:18:45 +01:00
|
|
|
rtl: {
|
|
|
|
files: [
|
|
|
|
SOURCE_DIR + 'wp-admin/css/*.css',
|
|
|
|
SOURCE_DIR + 'wp-includes/css/*.css'
|
|
|
|
],
|
2015-02-27 14:40:03 +01:00
|
|
|
tasks: ['rtlcss:dynamic'],
|
2013-11-12 22:18:45 +01:00
|
|
|
options: {
|
|
|
|
spawn: false,
|
|
|
|
interval: 2000
|
|
|
|
}
|
|
|
|
},
|
2013-08-30 06:06:34 +02:00
|
|
|
test: {
|
2014-02-10 02:11:25 +01:00
|
|
|
files: [
|
|
|
|
'tests/qunit/**',
|
|
|
|
'!tests/qunit/editor/**'
|
|
|
|
],
|
2013-08-30 06:06:34 +02:00
|
|
|
tasks: ['qunit']
|
2013-08-07 07:25:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Register tasks.
|
2013-10-06 12:33:01 +02:00
|
|
|
|
2013-11-12 22:18:45 +01:00
|
|
|
// RTL task.
|
2015-02-27 14:40:03 +01:00
|
|
|
grunt.registerTask('rtl', ['rtlcss:core', 'rtlcss:colors']);
|
2013-11-12 22:18:45 +01:00
|
|
|
|
2013-11-14 00:37:30 +01:00
|
|
|
// Color schemes task.
|
2014-02-13 09:29:16 +01:00
|
|
|
grunt.registerTask('colors', ['sass:colors', 'autoprefixer:colors']);
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
git-svn-id: https://develop.svn.wordpress.org/trunk@26137 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-13 20:37:10 +01:00
|
|
|
|
2014-06-28 04:08:05 +02:00
|
|
|
// JSHint task.
|
2015-02-09 17:00:44 +01:00
|
|
|
grunt.registerTask( 'jshint:corejs', [
|
|
|
|
'jshint:grunt',
|
|
|
|
'jshint:tests',
|
|
|
|
'jshint:themes',
|
|
|
|
'jshint:core',
|
|
|
|
'jshint:media'
|
|
|
|
] );
|
2014-06-28 04:08:05 +02:00
|
|
|
|
2015-03-05 20:48:59 +01:00
|
|
|
grunt.renameTask( 'watch', '_watch' );
|
2014-02-13 18:56:29 +01:00
|
|
|
|
2015-03-05 20:48:59 +01:00
|
|
|
grunt.registerTask( 'watch', function() {
|
|
|
|
if ( ! this.args.length || this.args.indexOf( 'browserify' ) > -1 ) {
|
|
|
|
grunt.config( 'browserify.options', {
|
|
|
|
browserifyOptions: {
|
|
|
|
debug: true
|
|
|
|
},
|
|
|
|
watch: true
|
|
|
|
} );
|
2014-02-19 22:42:36 +01:00
|
|
|
|
2015-03-05 20:48:59 +01:00
|
|
|
grunt.task.run( 'browserify' );
|
|
|
|
}
|
|
|
|
|
|
|
|
grunt.task.run( '_' + this.nameArgs );
|
|
|
|
} );
|
|
|
|
|
|
|
|
grunt.registerTask( 'precommit', 'Runs front-end dev/test tasks in preparation for a commit.', [
|
|
|
|
'autoprefixer:core',
|
|
|
|
'imagemin:core',
|
|
|
|
'browserify',
|
|
|
|
'jshint:corejs',
|
2015-03-13 22:08:14 +01:00
|
|
|
'uglify:bookmarklet',
|
|
|
|
'qunit:compiled'
|
2015-03-05 20:48:59 +01:00
|
|
|
] );
|
|
|
|
|
|
|
|
grunt.registerTask( 'copy:all', [
|
|
|
|
'copy:files',
|
|
|
|
'copy:wp-admin-rtl',
|
|
|
|
'copy:version'
|
|
|
|
] );
|
|
|
|
|
|
|
|
grunt.registerTask( 'build', [
|
|
|
|
'clean:all',
|
|
|
|
'copy:all',
|
|
|
|
'cssmin:core',
|
|
|
|
'colors',
|
|
|
|
'rtl',
|
|
|
|
'cssmin:rtl',
|
|
|
|
'cssmin:colors',
|
|
|
|
'uglify:core',
|
|
|
|
'uglify:jqueryui',
|
|
|
|
'concat:tinymce',
|
|
|
|
'compress:tinymce',
|
|
|
|
'clean:tinymce',
|
2015-03-25 00:32:23 +01:00
|
|
|
'concat:emoji',
|
|
|
|
'includes:emoji',
|
2015-03-05 20:48:59 +01:00
|
|
|
'jsvalidate:build'
|
|
|
|
] );
|
2013-08-07 07:25:25 +02:00
|
|
|
|
2013-11-09 21:43:58 +01:00
|
|
|
// Testing tasks.
|
2014-11-10 15:48:28 +01:00
|
|
|
grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() {
|
2013-11-09 22:25:02 +01:00
|
|
|
grunt.util.spawn({
|
|
|
|
cmd: this.data.cmd,
|
|
|
|
args: this.data.args,
|
|
|
|
opts: {stdio: 'inherit'}
|
|
|
|
}, this.async());
|
2013-11-09 22:18:23 +01:00
|
|
|
});
|
|
|
|
|
2013-11-09 22:25:02 +01:00
|
|
|
grunt.registerTask('qunit:compiled', 'Runs QUnit tests on compiled as well as uncompiled scripts.',
|
2013-11-13 00:20:28 +01:00
|
|
|
['build', 'copy:qunit', 'qunit']);
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
git-svn-id: https://develop.svn.wordpress.org/trunk@26876 602fd350-edb4-49c9-b593-d223f7449a82
2013-12-29 00:52:04 +01:00
|
|
|
|
2013-11-09 22:25:02 +01:00
|
|
|
grunt.registerTask('test', 'Runs all QUnit and PHPUnit tasks.', ['qunit:compiled', 'phpunit']);
|
2014-06-21 22:05:19 +02:00
|
|
|
|
|
|
|
// Travis CI tasks.
|
2014-06-28 04:08:05 +02:00
|
|
|
grunt.registerTask('travis:js', 'Runs Javascript Travis CI tasks.', [ 'jshint:corejs', 'qunit:compiled' ]);
|
2014-06-21 22:05:19 +02:00
|
|
|
grunt.registerTask('travis:phpunit', 'Runs PHPUnit Travis CI tasks.', 'phpunit');
|
2013-08-30 06:06:34 +02:00
|
|
|
|
2014-02-26 22:45:55 +01:00
|
|
|
// Patch task.
|
|
|
|
grunt.renameTask('patch_wordpress', 'patch');
|
|
|
|
|
2013-08-07 07:25:25 +02:00
|
|
|
// Default task.
|
|
|
|
grunt.registerTask('default', ['build']);
|
|
|
|
|
|
|
|
// Add a listener to the watch task.
|
|
|
|
//
|
|
|
|
// On `watch:all`, automatically updates the `copy:dynamic` and `clean:dynamic`
|
|
|
|
// configurations so that only the changed files are updated.
|
2015-02-27 14:40:03 +01:00
|
|
|
// On `watch:rtl`, automatically updates the `rtlcss:dynamic` configuration.
|
2013-08-31 00:16:43 +02:00
|
|
|
grunt.event.on('watch', function( action, filepath, target ) {
|
2013-11-12 22:18:45 +01:00
|
|
|
if ( target !== 'all' && target !== 'rtl' ) {
|
2013-08-31 00:16:43 +02:00
|
|
|
return;
|
2013-10-27 22:53:11 +01:00
|
|
|
}
|
2013-08-31 00:16:43 +02:00
|
|
|
|
2013-10-27 22:53:11 +01:00
|
|
|
var relativePath = path.relative( SOURCE_DIR, filepath ),
|
|
|
|
cleanSrc = ( action === 'deleted' ) ? [relativePath] : [],
|
|
|
|
copySrc = ( action === 'deleted' ) ? [] : [relativePath];
|
2013-08-07 07:25:25 +02:00
|
|
|
|
|
|
|
grunt.config(['clean', 'dynamic', 'src'], cleanSrc);
|
|
|
|
grunt.config(['copy', 'dynamic', 'src'], copySrc);
|
2015-02-27 14:40:03 +01:00
|
|
|
grunt.config(['rtlcss', 'dynamic', 'src'], copySrc);
|
2013-08-07 07:25:25 +02:00
|
|
|
});
|
|
|
|
};
|