2013-10-27 22:53:11 +01:00
|
|
|
/* jshint node:true */
|
2017-10-03 09:11:28 +02:00
|
|
|
/* globals Set */
|
2017-10-04 23:00:15 +02:00
|
|
|
var webpackConfig = require( './webpack.config.prod' );
|
|
|
|
var webpackDevConfig = require( './webpack.config.dev' );
|
|
|
|
|
2013-08-07 07:25:25 +02:00
|
|
|
module.exports = function(grunt) {
|
2013-10-27 22:53:11 +01:00
|
|
|
var path = require('path'),
|
2016-04-13 00:33:18 +02:00
|
|
|
fs = require( 'fs' ),
|
2017-10-03 09:11:28 +02:00
|
|
|
spawn = require( 'child_process' ).spawnSync,
|
2013-10-27 22:53:11 +01:00
|
|
|
SOURCE_DIR = 'src/',
|
2015-03-05 20:48:59 +01:00
|
|
|
BUILD_DIR = 'build/',
|
2017-08-19 22:09:31 +02:00
|
|
|
BANNER_TEXT = '/*! This file is auto-generated */',
|
2017-10-04 23:00:15 +02:00
|
|
|
autoprefixer = require( 'autoprefixer' );
|
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
|
|
|
|
2013-08-07 07:25:25 +02:00
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
2015-07-08 21:53:22 +02:00
|
|
|
postcss: {
|
2014-02-13 09:29:16 +01:00
|
|
|
options: {
|
2015-07-08 21:53:22 +02:00
|
|
|
processors: [
|
|
|
|
autoprefixer({
|
2015-11-02 21:43:55 +01:00
|
|
|
browsers: [
|
Update autoprefixer browser support matrix
WordPress no longer supports many old old browsers: https://make.wordpress.org/core/2017/04/23/target-browser-coverage/
This also removes alot of no longer necessary CSS. It served us well, but we are never getting back together with IE8,9,10.
So, in the (paraphrased) words of Taylor Swift:
I remember when we dropped support the first time
Saying, "This is it, I've had enough, " 'cause like
We hadn't seen many users in a month
When you said you needed flexbox. (What?)
Then you postMessage again and say
"IE8, I miss you and I swear I'm gonna change, trust me."
Remember how that lasted for a day?
I say, "I hate the box model, " we break up, you call me, "I love css-grids."
Ooh, we called it off again last night
But ooh, this time I'm telling you, I'm telling you
We are never ever ever supporting IE 8,9,10,
We are never ever ever supporting IE 8,9,10,
You go talk to EDGE, talk to my FIREFOX, talk to CHROME
But we are never ever ever ever getting back together
Like, ever...
Fixes #37651.
Props stunnedbeast, netweb, jorbin.
git-svn-id: https://develop.svn.wordpress.org/trunk@41062 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-16 03:14:36 +02:00
|
|
|
'> 1%',
|
|
|
|
'ie >= 11',
|
|
|
|
'last 1 Android versions',
|
|
|
|
'last 1 ChromeAndroid versions',
|
|
|
|
'last 2 Chrome versions',
|
|
|
|
'last 2 Firefox versions',
|
|
|
|
'last 2 Safari versions',
|
|
|
|
'last 2 iOS versions',
|
|
|
|
'last 2 Edge versions',
|
|
|
|
'last 2 Opera versions'
|
2015-11-02 21:43:55 +01:00
|
|
|
],
|
2015-07-08 21:53:22 +02:00
|
|
|
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'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2017-08-19 22:09:31 +02:00
|
|
|
usebanner: {
|
|
|
|
options: {
|
|
|
|
position: 'top',
|
|
|
|
banner: BANNER_TEXT,
|
2017-08-20 11:12:36 +02:00
|
|
|
linebreak: true
|
2017-08-19 22:09:31 +02:00
|
|
|
},
|
|
|
|
files: {
|
|
|
|
src: [
|
|
|
|
BUILD_DIR + 'wp-admin/css/*.min.css',
|
|
|
|
BUILD_DIR + 'wp-includes/css/*.min.css',
|
2017-08-20 11:12:36 +02:00
|
|
|
BUILD_DIR + 'wp-admin/css/colors/*/*.css'
|
2017-08-19 22:09:31 +02:00
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
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
|
|
|
},
|
2016-01-18 10:56:06 +01:00
|
|
|
'wp-admin-css-compat-rtl': {
|
2014-02-19 22:42:36 +01:00
|
|
|
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'
|
|
|
|
},
|
2016-01-18 10:56:06 +01:00
|
|
|
'wp-admin-css-compat-min': {
|
|
|
|
options: {
|
|
|
|
processContent: function( src ) {
|
|
|
|
return src.replace( /\.css/g, '.min.css' );
|
|
|
|
}
|
|
|
|
},
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
src: SOURCE_DIR + 'wp-admin/css/wp-admin.css',
|
|
|
|
dest: BUILD_DIR + 'wp-admin/css/wp-admin.min.css'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
src: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.css',
|
|
|
|
dest: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.min.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$/, '' );
|
|
|
|
|
2016-01-15 12:53:29 +01:00
|
|
|
// If the version includes an SVN commit (-12345), it's not a released alpha/beta. Append a timestamp.
|
2016-01-20 03:01:57 +01:00
|
|
|
version = version.replace( /-[\d]{5}$/, '-' + grunt.template.today( 'yyyymmdd.HHMMss' ) );
|
2014-05-29 06:32:41 +02:00
|
|
|
|
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
|
|
|
}
|
|
|
|
},
|
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: {
|
2015-11-18 21:27:45 +01:00
|
|
|
compatibility: 'ie7'
|
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: [
|
2016-01-18 10:56:06 +01:00
|
|
|
'wp-admin/css/*.css',
|
|
|
|
'!wp-admin/css/wp-admin*.css',
|
2016-02-29 21:42:10 +01:00
|
|
|
'wp-includes/css/*.css',
|
|
|
|
'wp-includes/js/mediaelement/wp-mediaelement.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: [
|
2016-01-18 10:56:06 +01:00
|
|
|
'wp-admin/css/*-rtl.css',
|
|
|
|
'!wp-admin/css/wp-admin*.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
|
2016-03-10 17:00:11 +01:00
|
|
|
opts: {
|
|
|
|
clean: false,
|
|
|
|
processUrls: { atrule: true, decl: false },
|
2015-02-27 14:40:03 +01:00
|
|
|
stringMap: [
|
|
|
|
{
|
|
|
|
name: 'import-rtl-stylesheet',
|
2016-03-10 17:00:11 +01:00
|
|
|
priority: 10,
|
|
|
|
exclusive: true,
|
2015-02-27 14:40:03 +01:00
|
|
|
search: [ '.css' ],
|
|
|
|
replace: [ '-rtl.css' ],
|
|
|
|
options: {
|
|
|
|
scope: 'url',
|
|
|
|
ignoreCase: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2013-12-06 19:34:05 +01:00
|
|
|
},
|
2016-03-10 17:00:11 +01:00
|
|
|
saveUnmodified: false,
|
|
|
|
plugins: [
|
2015-02-27 21:18:05 +01:00
|
|
|
{
|
|
|
|
name: 'swap-dashicons-left-right-arrows',
|
2016-03-10 17:00:11 +01:00
|
|
|
priority: 10,
|
|
|
|
directives: {
|
|
|
|
control: {},
|
|
|
|
value: []
|
|
|
|
},
|
|
|
|
processors: [
|
|
|
|
{
|
|
|
|
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 21:18:05 +01:00
|
|
|
}
|
2016-03-10 17:00:11 +01:00
|
|
|
]
|
2015-02-27 21:18:05 +01:00
|
|
|
}
|
2016-03-10 17:00:11 +01:00
|
|
|
]
|
2015-02-27 14:40:03 +01:00
|
|
|
},
|
|
|
|
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
|
Embeds: Add oEmbed provider support.
For the past 6 years, WordPress has operated as an oEmbed consumer, allowing users to easily embed content from other sites. By adding oEmbed provider support, this allows any oEmbed consumer to embed posts from WordPress sites.
In addition to creating an oEmbed provider, WordPress' oEmbed consumer code has been enhanced to work with any site that provides oEmbed data (as long as it matches some strict security rules), and provides a preview from within the post editor.
For security, embeds appear within a sandboxed iframe - the iframe content is a template that can be styled or replaced entirely by the theme on the provider site.
Props swissspidy, pento, melchoyce, netweb, pfefferle, johnbillion, extendwings, davidbinda, danielbachhuber, SergeyBiryukov, afercia
Fixes #32522.
git-svn-id: https://develop.svn.wordpress.org/trunk@34903 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 12:35:18 +02:00
|
|
|
'!wp-includes/css/dashicons.css',
|
2015-10-31 05:37:41 +01:00
|
|
|
'!wp-includes/css/wp-embed-template.css',
|
|
|
|
'!wp-includes/css/wp-embed-template-ie.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
|
2016-10-20 07:43:09 +02:00
|
|
|
'!twenty{fourteen,fifteen,sixteen}/js/html5.js',
|
|
|
|
'!twentyseventeen/assets/js/html5.js',
|
|
|
|
'!twentyseventeen/assets/js/jquery.scrollTo.js'
|
2013-11-13 00:41:17 +01:00
|
|
|
]
|
|
|
|
},
|
2015-02-09 17:00:44 +01:00
|
|
|
media: {
|
|
|
|
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: [
|
2017-05-20 06:17:33 +02:00
|
|
|
'wp-admin/js/**/*.js',
|
2013-11-07 22:14:49 +01:00
|
|
|
'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',
|
2017-10-16 20:06:11 +02:00
|
|
|
'wp-includes/js/mediaelement/mediaelement-migrate.js',
|
2013-11-07 22:14:49 +01:00
|
|
|
'wp-includes/js/mediaelement/wp-mediaelement.js',
|
2016-02-29 21:42:10 +01:00
|
|
|
'wp-includes/js/mediaelement/wp-playlist.js',
|
2013-11-07 22:14:49 +01:00
|
|
|
'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
|
Editor: Add CodeMirror-powered code editor with syntax highlighting, linting, and auto-completion.
* Code editor is integrated into the Theme/Plugin Editor, Additional CSS in Customizer, and Custom HTML widget. Code editor is not yet integrated into the post editor, and it may not be until accessibility concerns are addressed.
* The CodeMirror component in the Custom HTML widget is integrated in a similar way to TinyMCE being integrated into the Text widget, adopting the same approach for integrating dynamic JavaScript-initialized fields.
* Linting is performed for JS, CSS, HTML, and JSON via JSHint, CSSLint, HTMLHint, and JSONLint respectively. Linting is not yet supported for PHP.
* When user lacks `unfiltered_html` the capability, the Custom HTML widget will report any Kses-invalid elements and attributes as errors via a custom Kses rule for HTMLHint.
* When linting errors are detected, the user will be prevented from saving the code until the errors are fixed, reducing instances of broken websites.
* The placeholder value is removed from Custom CSS in favor of a fleshed-out section description which now auto-expands when the CSS field is empty. See #39892.
* The CodeMirror library is included as `wp.CodeMirror` to prevent conflicts with any existing `CodeMirror` global.
* An `wp.codeEditor.initialize()` API in JS is provided to convert a `textarea` into CodeMirror, with a `wp_enqueue_code_editor()` function in PHP to manage enqueueing the assets and settings needed to edit a given type of code.
* A user preference is added to manage whether or not "syntax highlighting" is enabled. The feature is opt-out, being enabled by default.
* Allowed file extensions in the theme and plugin editors have been updated to include formats which CodeMirror has modes for: `conf`, `css`, `diff`, `patch`, `html`, `htm`, `http`, `js`, `json`, `jsx`, `less`, `md`, `php`, `phtml`, `php3`, `php4`, `php5`, `php7`, `phps`, `scss`, `sass`, `sh`, `bash`, `sql`, `svg`, `xml`, `yml`, `yaml`, `txt`.
Props westonruter, georgestephanis, obenland, melchoyce, pixolin, mizejewski, michelleweber, afercia, grahamarmfield, samikeijonen, rianrietveld, iseulde.
See #38707.
Fixes #12423, #39892.
git-svn-id: https://develop.svn.wordpress.org/trunk@41376 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-13 08:07:48 +02:00
|
|
|
'!wp-includes/js/codemirror/*.js',
|
2013-11-07 22:14:49 +01:00
|
|
|
'!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',
|
2017-10-04 22:24:52 +02: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
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2017-09-08 20:41:20 +02:00
|
|
|
jsdoc : {
|
|
|
|
dist : {
|
|
|
|
dest: 'jsdoc',
|
|
|
|
options: {
|
|
|
|
configure : 'jsdoc.conf.json'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
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',
|
2017-04-22 22:24:11 +02:00
|
|
|
args: ['--verbose', '-c', 'phpunit.xml.dist']
|
2013-11-09 22:18:23 +01:00
|
|
|
},
|
|
|
|
ajax: {
|
|
|
|
cmd: 'phpunit',
|
2017-04-22 22:24:11 +02:00
|
|
|
args: ['--verbose', '-c', 'phpunit.xml.dist', '--group', 'ajax']
|
2013-11-09 22:18:23 +01:00
|
|
|
},
|
|
|
|
multisite: {
|
|
|
|
cmd: 'phpunit',
|
2017-04-22 22:24:11 +02:00
|
|
|
args: ['--verbose', '-c', 'tests/phpunit/multisite.xml']
|
2014-11-10 15:48:28 +01:00
|
|
|
},
|
2017-10-02 00:15:16 +02:00
|
|
|
'ms-files': {
|
|
|
|
cmd: 'phpunit',
|
|
|
|
args: ['--verbose', '-c', 'tests/phpunit/multisite.xml', '--group', 'ms-files']
|
|
|
|
},
|
2014-11-10 15:48:28 +01:00
|
|
|
'external-http': {
|
|
|
|
cmd: 'phpunit',
|
2017-04-22 22:24:11 +02:00
|
|
|
args: ['--verbose', '-c', 'phpunit.xml.dist', '--group', 'external-http']
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
},
|
|
|
|
'restapi-jsclient': {
|
|
|
|
cmd: 'phpunit',
|
2017-04-22 22:24:11 +02:00
|
|
|
args: ['--verbose', '-c', 'phpunit.xml.dist', '--group', 'restapi-jsclient']
|
2013-11-09 22:18:23 +01:00
|
|
|
}
|
|
|
|
},
|
2013-08-07 07:25:25 +02:00
|
|
|
uglify: {
|
2015-07-16 11:44:43 +02:00
|
|
|
options: {
|
2016-11-03 06:39:10 +01:00
|
|
|
ASCIIOnly: true,
|
|
|
|
screwIE8: false
|
2015-07-16 11:44:43 +02:00
|
|
|
},
|
2013-08-07 07:25:25 +02:00
|
|
|
core: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.min.js',
|
|
|
|
src: [
|
2017-05-11 20:54:24 +02:00
|
|
|
'wp-admin/js/**/*.js',
|
2013-08-07 07:25:25 +02:00
|
|
|
'wp-includes/js/*.js',
|
2017-09-22 22:09:49 +02:00
|
|
|
'wp-includes/js/plupload/*.js',
|
2016-02-29 21:42:10 +01:00
|
|
|
'wp-includes/js/mediaelement/wp-mediaelement.js',
|
|
|
|
'wp-includes/js/mediaelement/wp-playlist.js',
|
2017-10-18 04:25:06 +02:00
|
|
|
'wp-includes/js/mediaelement/mediaelement-migrate.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
|
|
|
|
'!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.*',
|
2015-11-20 00:05:39 +01:00
|
|
|
'!wp-includes/js/zxcvbn.min.js',
|
|
|
|
'!wp-includes/js/wp-embed.js' // We have extra options for this, see uglify:embed
|
2013-08-07 07:25:25 +02:00
|
|
|
]
|
2014-10-07 17:27:56 +02:00
|
|
|
},
|
2015-11-20 00:05:39 +01:00
|
|
|
embed: {
|
|
|
|
options: {
|
|
|
|
compress: {
|
|
|
|
conditionals: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.min.js',
|
|
|
|
src: ['wp-includes/js/wp-embed.js']
|
|
|
|
},
|
2015-02-09 01:42:28 +01:00
|
|
|
media: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.min.js',
|
|
|
|
src: [
|
2015-09-09 04:02:14 +02:00
|
|
|
'wp-includes/js/media-audiovideo.js',
|
|
|
|
'wp-includes/js/media-grid.js',
|
|
|
|
'wp-includes/js/media-models.js',
|
|
|
|
'wp-includes/js/media-views.js'
|
2015-02-09 01:42:28 +01:00
|
|
|
]
|
|
|
|
},
|
2014-10-07 17:27:56 +02:00
|
|
|
jqueryui: {
|
|
|
|
options: {
|
2015-11-07 13:36:24 +01:00
|
|
|
// Preserve comments that start with a bang.
|
|
|
|
preserveComments: /^!/
|
2014-10-07 17:27:56 +02:00
|
|
|
},
|
|
|
|
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
|
|
|
},
|
2016-08-18 20:54:41 +02:00
|
|
|
masonry: {
|
|
|
|
options: {
|
|
|
|
// Preserve comments that start with a bang.
|
|
|
|
preserveComments: /^!/
|
|
|
|
},
|
|
|
|
src: SOURCE_DIR + 'wp-includes/js/jquery/jquery.masonry.js',
|
2016-08-18 22:04:16 +02:00
|
|
|
dest: SOURCE_DIR + 'wp-includes/js/jquery/jquery.masonry.min.js'
|
2013-08-07 07:25:25 +02:00
|
|
|
}
|
|
|
|
},
|
2017-10-04 23:00:15 +02:00
|
|
|
webpack: {
|
|
|
|
prod: webpackConfig,
|
|
|
|
dev: webpackDevConfig
|
|
|
|
},
|
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: '.'
|
Embeds: Add oEmbed provider support.
For the past 6 years, WordPress has operated as an oEmbed consumer, allowing users to easily embed content from other sites. By adding oEmbed provider support, this allows any oEmbed consumer to embed posts from WordPress sites.
In addition to creating an oEmbed provider, WordPress' oEmbed consumer code has been enhanced to work with any site that provides oEmbed data (as long as it matches some strict security rules), and provides a preview from within the post editor.
For security, embeds appear within a sandboxed iframe - the iframe content is a template that can be styled or replaced entirely by the theme on the provider site.
Props swissspidy, pento, melchoyce, netweb, pfefferle, johnbillion, extendwings, davidbinda, danielbachhuber, SergeyBiryukov, afercia
Fixes #32522.
git-svn-id: https://develop.svn.wordpress.org/trunk@34903 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 12:35:18 +02:00
|
|
|
},
|
2015-10-17 03:20:19 +02:00
|
|
|
embed: {
|
2015-11-20 16:36:21 +01:00
|
|
|
src: BUILD_DIR + 'wp-includes/embed.php',
|
Embeds: Add oEmbed provider support.
For the past 6 years, WordPress has operated as an oEmbed consumer, allowing users to easily embed content from other sites. By adding oEmbed provider support, this allows any oEmbed consumer to embed posts from WordPress sites.
In addition to creating an oEmbed provider, WordPress' oEmbed consumer code has been enhanced to work with any site that provides oEmbed data (as long as it matches some strict security rules), and provides a preview from within the post editor.
For security, embeds appear within a sandboxed iframe - the iframe content is a template that can be styled or replaced entirely by the theme on the provider site.
Props swissspidy, pento, melchoyce, netweb, pfefferle, johnbillion, extendwings, davidbinda, danielbachhuber, SergeyBiryukov, afercia
Fixes #32522.
git-svn-id: https://develop.svn.wordpress.org/trunk@34903 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 12:35:18 +02:00
|
|
|
dest: '.'
|
2015-03-25 00:32:23 +01:00
|
|
|
}
|
|
|
|
},
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
replace: {
|
|
|
|
emojiRegex: {
|
|
|
|
options: {
|
|
|
|
patterns: [
|
|
|
|
{
|
2017-10-03 09:11:28 +02:00
|
|
|
match: /\/\/ START: emoji arrays[\S\s]*\/\/ END: emoji arrays/g,
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
replacement: function () {
|
2017-10-03 09:11:28 +02:00
|
|
|
var regex, files,
|
|
|
|
partials, partialsSet,
|
|
|
|
entities, emojiArray;
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
grunt.log.writeln( 'Fetching list of Twemoji files...' );
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
// Fetch a list of the files that Twemoji supplies
|
|
|
|
files = spawn( 'svn', [ 'ls', 'https://github.com/twitter/twemoji.git/branches/gh-pages/2/assets' ] );
|
|
|
|
if ( 0 !== files.status ) {
|
|
|
|
grunt.fatal( 'Unable to fetch Twemoji file list' );
|
|
|
|
}
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
entities = files.stdout.toString();
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
// Tidy up the file list
|
|
|
|
entities = entities.replace( /\.ai/g, '' );
|
|
|
|
entities = entities.replace( /^$/g, '' );
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
// Convert the emoji entities to HTML entities
|
|
|
|
partials = entities = entities.replace( /([a-z0-9]+)/g, '&#x$1;' );
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
// Remove the hyphens between the HTML entities
|
|
|
|
entities = entities.replace( /-/g, '' );
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
// Sort the entities list by length, so the longest emoji will be found first
|
|
|
|
emojiArray = entities.split( '\n' ).sort( function ( a, b ) {
|
|
|
|
return b.length - a.length;
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
} );
|
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
// Convert the entities list to PHP array syntax
|
|
|
|
entities = '\'' + emojiArray.filter( function( val ) {
|
|
|
|
return val.length >= 8 ? val : false ;
|
|
|
|
} ).join( '\',\'' ) + '\'';
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
// Create a list of all characters used by the emoji list
|
|
|
|
partials = partials.replace( /-/g, '\n' );
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
// Set automatically removes duplicates
|
|
|
|
partialsSet = new Set( partials.split( '\n' ) );
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
// Convert the partials list to PHP array syntax
|
|
|
|
partials = '\'' + Array.from( partialsSet ).filter( function( val ) {
|
|
|
|
return val.length >= 8 ? val : false ;
|
|
|
|
} ).join( '\',\'' ) + '\'';
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 09:11:28 +02:00
|
|
|
regex = '// START: emoji arrays\n';
|
|
|
|
regex += '\t$entities = array(' + entities + ');\n';
|
|
|
|
regex += '\t$partials = array(' + partials + ');\n';
|
|
|
|
regex += '\t// END: emoji arrays';
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
|
|
|
return regex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
flatten: true,
|
|
|
|
src: [
|
|
|
|
SOURCE_DIR + 'wp-includes/formatting.php'
|
|
|
|
],
|
|
|
|
dest: SOURCE_DIR + 'wp-includes/'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2015-03-05 20:48:59 +01:00
|
|
|
_watch: {
|
2013-08-07 07:25:25 +02:00
|
|
|
all: {
|
|
|
|
files: [
|
|
|
|
SOURCE_DIR + '**',
|
2015-09-09 04:11:23 +02:00
|
|
|
'!' + SOURCE_DIR + 'wp-includes/js/media/**',
|
2013-08-07 07:25:25 +02:00
|
|
|
// 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
|
|
|
},
|
2014-09-29 19:20:58 +02:00
|
|
|
config: {
|
2017-10-04 23:00:15 +02:00
|
|
|
files: [
|
|
|
|
'Gruntfile.js',
|
|
|
|
'webpack-dev.config.js',
|
|
|
|
'webpack.config.js'
|
|
|
|
]
|
2014-09-29 19:20:58 +02:00
|
|
|
},
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-10-21 00:23:21 +02:00
|
|
|
// Allow builds to be minimal
|
|
|
|
if( grunt.option( 'minimal-copy' ) ) {
|
|
|
|
var copyFilesOptions = grunt.config.get( 'copy.files.files' );
|
|
|
|
copyFilesOptions[0].src.push( '!wp-content/plugins/**' );
|
|
|
|
copyFilesOptions[0].src.push( '!wp-content/themes/!(twenty*)/**' );
|
|
|
|
grunt.config.set( 'copy.files.files', copyFilesOptions );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-07 07:25:25 +02:00
|
|
|
// Register tasks.
|
2013-10-06 12:33:01 +02:00
|
|
|
|
2017-10-04 23:00:15 +02:00
|
|
|
// Webpack task.
|
|
|
|
grunt.loadNpmTasks( 'grunt-webpack' );
|
|
|
|
|
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.
|
2015-07-08 21:53:22 +02:00
|
|
|
grunt.registerTask('colors', ['sass:colors', 'postcss: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
|
|
|
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
grunt.registerTask( 'restapi-jsclient', [
|
|
|
|
'phpunit:restapi-jsclient',
|
2017-02-15 18:58:14 +01:00
|
|
|
'qunit:compiled'
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01: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() {
|
2017-10-04 23:00:15 +02:00
|
|
|
if ( ! this.args.length || this.args.indexOf( 'webpack' ) > -1 ) {
|
2014-02-19 22:42:36 +01:00
|
|
|
|
2017-10-04 23:00:15 +02:00
|
|
|
grunt.task.run( 'webpack:dev' );
|
2015-03-05 20:48:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
grunt.task.run( '_' + this.nameArgs );
|
|
|
|
} );
|
|
|
|
|
2016-04-15 12:18:03 +02:00
|
|
|
grunt.registerTask( 'precommit:image', [
|
2016-03-09 21:54:10 +01:00
|
|
|
'imagemin:core'
|
|
|
|
] );
|
|
|
|
|
|
|
|
grunt.registerTask( 'precommit:js', [
|
2017-10-04 23:00:15 +02:00
|
|
|
'webpack:prod',
|
2015-03-05 20:48:59 +01:00
|
|
|
'jshint:corejs',
|
2016-08-18 20:54:41 +02:00
|
|
|
'uglify:masonry',
|
2015-03-13 22:08:14 +01:00
|
|
|
'qunit:compiled'
|
2015-03-05 20:48:59 +01:00
|
|
|
] );
|
|
|
|
|
2016-03-09 21:54:10 +01:00
|
|
|
grunt.registerTask( 'precommit:css', [
|
|
|
|
'postcss:core'
|
|
|
|
] );
|
|
|
|
|
|
|
|
grunt.registerTask( 'precommit:php', [
|
|
|
|
'phpunit'
|
|
|
|
] );
|
|
|
|
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
grunt.registerTask( 'precommit:emoji', [
|
|
|
|
'replace:emojiRegex'
|
|
|
|
] );
|
|
|
|
|
2016-03-09 21:54:10 +01:00
|
|
|
grunt.registerTask( 'precommit', 'Runs test and build tasks in preparation for a commit', function() {
|
|
|
|
var done = this.async();
|
2016-04-13 00:33:18 +02:00
|
|
|
var map = {
|
|
|
|
svn: 'svn status --ignore-externals',
|
|
|
|
git: 'git status --short'
|
|
|
|
};
|
|
|
|
|
|
|
|
find( [
|
|
|
|
__dirname + '/.svn',
|
|
|
|
__dirname + '/.git',
|
|
|
|
path.dirname( __dirname ) + '/.svn'
|
|
|
|
] );
|
|
|
|
|
|
|
|
function find( set ) {
|
|
|
|
var dir;
|
|
|
|
|
|
|
|
if ( set.length ) {
|
|
|
|
fs.stat( dir = set.shift(), function( error ) {
|
|
|
|
error ? find( set ) : run( path.basename( dir ).substr( 1 ) );
|
|
|
|
} );
|
|
|
|
} else {
|
2017-10-03 17:19:23 +02:00
|
|
|
runAllTasks();
|
2016-03-09 21:54:10 +01:00
|
|
|
}
|
|
|
|
}
|
2016-04-13 00:33:18 +02:00
|
|
|
|
2017-10-03 17:19:23 +02:00
|
|
|
function runAllTasks() {
|
|
|
|
grunt.log.writeln( 'Cannot determine which files are modified as SVN and GIT are not available.' );
|
|
|
|
grunt.log.writeln( 'Running all tasks and all tests.' );
|
|
|
|
grunt.task.run([
|
|
|
|
'precommit:js',
|
|
|
|
'precommit:css',
|
|
|
|
'precommit:image',
|
|
|
|
'precommit:emoji',
|
|
|
|
'precommit:php'
|
|
|
|
]);
|
|
|
|
|
|
|
|
done();
|
|
|
|
}
|
|
|
|
|
2016-04-13 00:33:18 +02:00
|
|
|
function run( type ) {
|
|
|
|
var command = map[ type ].split( ' ' );
|
|
|
|
|
|
|
|
grunt.util.spawn( {
|
|
|
|
cmd: command.shift(),
|
|
|
|
args: command
|
|
|
|
}, function( error, result, code ) {
|
2016-04-15 12:18:03 +02:00
|
|
|
var taskList = [];
|
|
|
|
|
2016-06-19 14:31:15 +02:00
|
|
|
// Callback for finding modified paths.
|
|
|
|
function testPath( path ) {
|
|
|
|
var regex = new RegExp( ' ' + path + '$', 'm' );
|
|
|
|
return regex.test( result.stdout );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Callback for finding modified files by extension.
|
|
|
|
function testExtension( extension ) {
|
|
|
|
var regex = new RegExp( '\.' + extension + '$', 'm' );
|
|
|
|
return regex.test( result.stdout );
|
|
|
|
}
|
|
|
|
|
2017-10-03 17:19:23 +02:00
|
|
|
if ( code === 0 ) {
|
|
|
|
if ( [ 'package.json', 'Gruntfile.js' ].some( testPath ) ) {
|
|
|
|
grunt.log.writeln( 'Configuration files modified. Running `prerelease`.' );
|
|
|
|
taskList.push( 'prerelease' );
|
|
|
|
} else {
|
|
|
|
if ( [ 'png', 'jpg', 'gif', 'jpeg' ].some( testExtension ) ) {
|
|
|
|
grunt.log.writeln( 'Image files modified. Minifying.' );
|
|
|
|
taskList.push( 'precommit:image' );
|
2016-06-07 05:32:22 +02:00
|
|
|
}
|
Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.
This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.
The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.
For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.
Fixes #35293.
git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 07:46:19 +02:00
|
|
|
|
2017-10-03 17:19:23 +02:00
|
|
|
[ 'js', 'css', 'php' ].forEach( function( extension ) {
|
|
|
|
if ( testExtension( extension ) ) {
|
|
|
|
grunt.log.writeln( extension.toUpperCase() + ' files modified. ' + extension.toUpperCase() + ' tests will be run.' );
|
|
|
|
taskList.push( 'precommit:' + extension );
|
|
|
|
}
|
|
|
|
} );
|
2016-04-13 00:33:18 +02:00
|
|
|
|
2017-10-03 17:19:23 +02:00
|
|
|
if ( [ 'twemoji.js' ].some( testPath ) ) {
|
|
|
|
grunt.log.writeln( 'twemoji.js has updated. Running `precommit:emoji.' );
|
|
|
|
taskList.push( 'precommit:emoji' );
|
|
|
|
}
|
|
|
|
}
|
2016-04-13 00:33:18 +02:00
|
|
|
|
2017-10-03 17:19:23 +02:00
|
|
|
grunt.task.run( taskList );
|
|
|
|
done();
|
|
|
|
} else {
|
|
|
|
runAllTasks();
|
|
|
|
}
|
2016-04-13 00:33:18 +02:00
|
|
|
} );
|
|
|
|
}
|
|
|
|
} );
|
2016-03-09 21:54:10 +01:00
|
|
|
|
2015-03-05 20:48:59 +01:00
|
|
|
grunt.registerTask( 'copy:all', [
|
|
|
|
'copy:files',
|
2016-01-18 10:56:06 +01:00
|
|
|
'copy:wp-admin-css-compat-rtl',
|
|
|
|
'copy:wp-admin-css-compat-min',
|
2015-03-05 20:48:59 +01:00
|
|
|
'copy:version'
|
|
|
|
] );
|
|
|
|
|
|
|
|
grunt.registerTask( 'build', [
|
|
|
|
'clean:all',
|
|
|
|
'copy:all',
|
|
|
|
'cssmin:core',
|
|
|
|
'colors',
|
|
|
|
'rtl',
|
|
|
|
'cssmin:rtl',
|
|
|
|
'cssmin:colors',
|
|
|
|
'uglify:core',
|
2015-11-20 00:05:39 +01:00
|
|
|
'uglify:embed',
|
2015-03-05 20:48:59 +01:00
|
|
|
'uglify:jqueryui',
|
|
|
|
'concat:tinymce',
|
|
|
|
'compress:tinymce',
|
|
|
|
'clean:tinymce',
|
2015-03-25 00:32:23 +01:00
|
|
|
'concat:emoji',
|
|
|
|
'includes:emoji',
|
2015-10-17 03:20:19 +02:00
|
|
|
'includes:embed',
|
2017-08-19 22:09:31 +02:00
|
|
|
'usebanner',
|
2015-03-05 20:48:59 +01:00
|
|
|
'jsvalidate:build'
|
|
|
|
] );
|
2013-08-07 07:25:25 +02:00
|
|
|
|
2016-03-10 06:36:15 +01:00
|
|
|
grunt.registerTask( 'prerelease', [
|
|
|
|
'precommit:php',
|
|
|
|
'precommit:js',
|
|
|
|
'precommit:css',
|
2016-04-15 12:18:03 +02:00
|
|
|
'precommit:image'
|
2016-03-10 06:36:15 +01: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');
|
|
|
|
|
2016-11-10 04:21:39 +01:00
|
|
|
// Add an alias `apply` of the `patch` task name.
|
|
|
|
grunt.registerTask('apply', 'patch');
|
|
|
|
|
2013-08-07 07:25:25 +02:00
|
|
|
// Default task.
|
|
|
|
grunt.registerTask('default', ['build']);
|
|
|
|
|
2015-09-09 04:11:23 +02:00
|
|
|
/*
|
|
|
|
* Automatically updates the `:dynamic` configurations
|
|
|
|
* so that only the changed files are updated.
|
|
|
|
*/
|
2013-08-31 00:16:43 +02:00
|
|
|
grunt.event.on('watch', function( action, filepath, target ) {
|
2015-09-09 04:11:23 +02:00
|
|
|
var src;
|
|
|
|
|
2017-10-04 23:00:15 +02:00
|
|
|
if ( [ 'all', 'rtl', 'webpack' ].indexOf( target ) === -1 ) {
|
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
|
|
|
|
2015-09-09 04:11:23 +02:00
|
|
|
src = [ path.relative( SOURCE_DIR, filepath ) ];
|
2015-10-07 02:00:00 +02:00
|
|
|
|
2015-09-09 04:11:23 +02:00
|
|
|
if ( action === 'deleted' ) {
|
|
|
|
grunt.config( [ 'clean', 'dynamic', 'src' ], src );
|
|
|
|
} else {
|
|
|
|
grunt.config( [ 'copy', 'dynamic', 'src' ], src );
|
2013-08-07 07:25:25 +02:00
|
|
|
|
2015-09-09 04:11:23 +02:00
|
|
|
if ( target === 'rtl' ) {
|
|
|
|
grunt.config( [ 'rtlcss', 'dynamic', 'src' ], src );
|
|
|
|
}
|
|
|
|
}
|
2013-08-07 07:25:25 +02:00
|
|
|
});
|
|
|
|
};
|