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/',
|
|
|
|
BUILD_DIR = 'build/';
|
2013-08-07 07:25:25 +02:00
|
|
|
|
2013-11-14 19:16:59 +01:00
|
|
|
// Load tasks.
|
2013-09-04 22:50:29 +02:00
|
|
|
require('matchdep').filterDev('grunt-*').forEach( grunt.loadNpmTasks );
|
|
|
|
|
2013-08-07 07:25:25 +02:00
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
clean: {
|
|
|
|
all: [BUILD_DIR],
|
|
|
|
dynamic: {
|
|
|
|
dot: true,
|
|
|
|
expand: true,
|
|
|
|
cwd: BUILD_DIR,
|
|
|
|
src: []
|
|
|
|
},
|
2013-08-31 00:16:43 +02:00
|
|
|
tinymce: {
|
|
|
|
src: [
|
|
|
|
'<%= concat.tinymce.dest %>',
|
|
|
|
BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce-schema.min.js',
|
|
|
|
BUILD_DIR + 'wp-includes/js/tinymce/mark_loaded.js'
|
|
|
|
]
|
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: [
|
|
|
|
'**',
|
|
|
|
'!**/.{svn,git}/**', // Ignore version control directories.
|
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
|
|
|
},
|
2013-10-06 12:33:01 +02:00
|
|
|
version: {
|
|
|
|
options: {
|
2013-10-27 22:53:11 +01:00
|
|
|
processContent: function( src ) {
|
|
|
|
return src.replace( /^(\$wp_version.+?)-src';/m, '$1\';' );
|
2013-10-06 12:33:01 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
src: SOURCE_DIR + 'wp-includes/version.php',
|
|
|
|
dest: BUILD_DIR + 'wp-includes/version.php'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
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 ) {
|
|
|
|
return src.replace( /([^\.])*\.\.\/src/ig , '/../build' );
|
|
|
|
}
|
|
|
|
}
|
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: {
|
|
|
|
core: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.min.css',
|
|
|
|
src: [
|
|
|
|
'wp-admin/css/*.css',
|
|
|
|
'wp-includes/css/*.css',
|
|
|
|
// Exceptions
|
2013-11-13 21:57:29 +01:00
|
|
|
'!wp-admin/css/theme.css', // Temporary file
|
2013-08-07 07:25:25 +02:00
|
|
|
'!wp-admin/css/farbtastic.css'
|
|
|
|
]
|
2013-11-12 22:18:45 +01:00
|
|
|
},
|
|
|
|
rtl: {
|
|
|
|
expand: true,
|
|
|
|
cwd: BUILD_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '.min.css',
|
|
|
|
src: [
|
|
|
|
'wp-admin/css/*-rtl.css',
|
|
|
|
'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
|
|
|
}
|
|
|
|
},
|
|
|
|
cssjanus: {
|
|
|
|
core: {
|
2013-12-06 19:34:05 +01:00
|
|
|
options: {
|
|
|
|
swapLtrRtlInUrl: false
|
|
|
|
},
|
2013-11-12 22:18:45 +01:00
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
ext: '-rtl.css',
|
|
|
|
src: [
|
|
|
|
'wp-admin/css/*.css',
|
2013-11-19 11:41:05 +01:00
|
|
|
'wp-includes/css/*.css'
|
2013-11-12 22:18:45 +01:00
|
|
|
]
|
|
|
|
},
|
2013-12-04 18:21:01 +01:00
|
|
|
colors: {
|
|
|
|
options: {
|
|
|
|
processContent: function( src ) {
|
2013-12-05 17:04:59 +01:00
|
|
|
return src.replace( /([^/]+)\.css/gi, '$1-rtl.css' );
|
2013-12-04 18:21:01 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
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',
|
|
|
|
'!tests/qunit/vendor/qunit.js'
|
|
|
|
],
|
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: [
|
|
|
|
'**/*.js',
|
|
|
|
'!twenty{eleven,twelve,thirteen}/**',
|
|
|
|
// Third party scripts
|
|
|
|
'!twentyfourteen/js/html5.js'
|
|
|
|
]
|
|
|
|
},
|
2013-11-07 22:14:49 +01:00
|
|
|
core: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
src: [
|
|
|
|
'wp-admin/js/*.js',
|
|
|
|
'wp-includes/js/*.js',
|
|
|
|
// 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',
|
|
|
|
'wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js',
|
|
|
|
'wp-includes/js/tinymce/plugins/wp*/editor_plugin_src.js',
|
|
|
|
'wp-includes/js/tinymce/mark_loaded_src.js',
|
|
|
|
// Third party scripts
|
|
|
|
'!wp-admin/js/farbtastic.js',
|
|
|
|
'!wp-admin/js/iris.min.js',
|
|
|
|
'!wp-includes/js/backbone.min.js',
|
|
|
|
'!wp-includes/js/swfobject.js',
|
|
|
|
'!wp-includes/js/underscore.min.js',
|
|
|
|
'!wp-includes/js/zxcvbn.min.js',
|
|
|
|
'!wp-includes/js/colorpicker.js',
|
|
|
|
'!wp-includes/js/hoverIntent.js',
|
|
|
|
'!wp-includes/js/json2.js',
|
|
|
|
'!wp-includes/js/tw-sack.js'
|
|
|
|
],
|
|
|
|
// Remove once other JSHint errors are resolved
|
|
|
|
options: {
|
|
|
|
curly: false,
|
|
|
|
eqeqeq: false
|
2013-11-08 01:40:38 +01:00
|
|
|
},
|
|
|
|
// Limit JSHint's run to a single specified file
|
|
|
|
// grunt jshint:core --file=filename.js
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2013-10-27 22:53:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2013-08-30 06:06:34 +02:00
|
|
|
qunit: {
|
|
|
|
files: ['tests/qunit/**/*.html']
|
|
|
|
},
|
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']
|
|
|
|
}
|
|
|
|
},
|
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',
|
|
|
|
'wp-includes/js/tinymce/plugins/wp*/js/*.js',
|
2013-08-31 00:16:43 +02:00
|
|
|
'wp-includes/js/tinymce/wp-tinymce-schema.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',
|
|
|
|
'!wp-includes/js/backbone.min.js',
|
|
|
|
'!wp-includes/js/swfobject.js',
|
2013-08-28 18:08:19 +02:00
|
|
|
'!wp-includes/js/underscore.min.js',
|
2013-08-31 00:16:43 +02:00
|
|
|
'!wp-includes/js/zxcvbn.min.js',
|
|
|
|
// Hard-coded in editimage.html
|
|
|
|
'!wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js'
|
2013-08-07 07:25:25 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
tinymce: {
|
|
|
|
expand: true,
|
|
|
|
cwd: SOURCE_DIR,
|
|
|
|
dest: BUILD_DIR,
|
|
|
|
src: [
|
|
|
|
'wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js',
|
2013-08-31 00:16:43 +02:00
|
|
|
'wp-includes/js/tinymce/plugins/wp*/editor_plugin_src.js',
|
|
|
|
'wp-includes/js/tinymce/mark_loaded_src.js'
|
2013-08-07 07:25:25 +02:00
|
|
|
],
|
|
|
|
// TinyMCE plugins use a nonstandard naming scheme: plugin files are named
|
|
|
|
// `editor_plugin_src.js`, and are compressed into `editor_plugin.js`.
|
|
|
|
rename: function(destBase, destPath) {
|
2013-08-31 00:16:43 +02:00
|
|
|
destPath = destPath.replace(/_src.js$/, '.js');
|
2013-08-07 07:25:25 +02:00
|
|
|
return path.join(destBase || '', destPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
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: [
|
|
|
|
BUILD_DIR + 'wp-includes/js/tinymce/tiny_mce.js',
|
|
|
|
BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce-schema.min.js',
|
|
|
|
BUILD_DIR + 'wp-includes/js/tinymce/themes/advanced/editor_template.js',
|
|
|
|
BUILD_DIR + 'wp-includes/js/tinymce/plugins/*/editor_plugin.js',
|
|
|
|
BUILD_DIR + 'wp-includes/js/tinymce/mark_loaded.js'
|
|
|
|
],
|
|
|
|
dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
compress: {
|
|
|
|
tinymce: {
|
|
|
|
options: {
|
|
|
|
mode: 'gzip',
|
|
|
|
level: 9
|
|
|
|
},
|
|
|
|
src: '<%= concat.tinymce.dest %>',
|
|
|
|
dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz'
|
|
|
|
}
|
|
|
|
},
|
2013-08-07 07:25:25 +02:00
|
|
|
watch: {
|
|
|
|
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
|
|
|
},
|
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'
|
|
|
|
],
|
|
|
|
tasks: ['cssjanus:dynamic'],
|
|
|
|
options: {
|
|
|
|
spawn: false,
|
|
|
|
interval: 2000
|
|
|
|
}
|
|
|
|
},
|
2013-08-30 06:06:34 +02:00
|
|
|
test: {
|
|
|
|
files: ['tests/qunit/**'],
|
|
|
|
tasks: ['qunit']
|
2013-08-07 07:25:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Register tasks.
|
2013-10-06 12:33:01 +02:00
|
|
|
|
|
|
|
// Copy task.
|
|
|
|
grunt.registerTask('copy:all', ['copy:files', 'copy:version']);
|
2013-11-12 22:18:45 +01:00
|
|
|
|
|
|
|
// RTL task.
|
2013-12-04 18:21:01 +01:00
|
|
|
grunt.registerTask('rtl', ['cssjanus:core', 'cssjanus:colors']);
|
2013-11-12 22:18:45 +01:00
|
|
|
|
2013-11-14 00:37:30 +01:00
|
|
|
// Color schemes task.
|
|
|
|
grunt.registerTask('colors', ['sass: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
|
|
|
|
2013-10-06 12:33:01 +02:00
|
|
|
// Build task.
|
2013-12-04 18:21:01 +01:00
|
|
|
grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 'colors', 'rtl', 'cssmin:rtl', 'cssmin:colors',
|
2013-11-12 22:18:45 +01:00
|
|
|
'uglify:core', 'uglify:tinymce', 'concat:tinymce', 'compress:tinymce', 'clean:tinymce']);
|
2013-08-07 07:25:25 +02:00
|
|
|
|
2013-11-09 21:43:58 +01:00
|
|
|
// Testing tasks.
|
2013-11-09 22:25:02 +01:00
|
|
|
grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax and multisite tests.', function() {
|
|
|
|
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']);
|
2013-11-09 22:25:02 +01:00
|
|
|
grunt.registerTask('test', 'Runs all QUnit and PHPUnit tasks.', ['qunit:compiled', 'phpunit']);
|
2013-08-30 06:06:34 +02:00
|
|
|
|
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.
|
2013-11-12 22:18:45 +01:00
|
|
|
// On `watch:rtl`, automatically updates the `cssjanus: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);
|
2013-11-12 22:18:45 +01:00
|
|
|
grunt.config(['cssjanus', 'dynamic', 'src'], copySrc);
|
2013-08-07 07:25:25 +02:00
|
|
|
});
|
|
|
|
};
|