|
@@ -10,7 +10,8 @@ module.exports = function(grunt) {
|
|
|
grunt.initConfig({
|
|
|
autoprefixer: {
|
|
|
options: {
|
|
|
- browsers: ['Android >= 2.1', 'Chrome >= 21', 'Explorer >= 7', 'Firefox >= 17', 'Opera >= 12.1', 'Safari >= 6.0']
|
|
|
+ browsers: ['Android >= 2.1', 'Chrome >= 21', 'Explorer >= 7', 'Firefox >= 17', 'Opera >= 12.1', 'Safari >= 6.0'],
|
|
|
+ cascade: false
|
|
|
},
|
|
|
core: {
|
|
|
expand: true,
|
|
@@ -54,6 +55,9 @@ module.exports = function(grunt) {
|
|
|
// Ignore unminified versions of external libs we don't ship:
|
|
|
'!wp-includes/js/backbone.js',
|
|
|
'!wp-includes/js/underscore.js',
|
|
|
+ '!wp-includes/js/jquery/jquery.masonry.js',
|
|
|
+ '!wp-includes/js/jquery/ui/*.js',
|
|
|
+ '!wp-includes/js/tinymce/tinymce.js',
|
|
|
'!wp-includes/version.php' // Exclude version.php
|
|
|
],
|
|
|
dest: BUILD_DIR
|
|
@@ -64,10 +68,27 @@ module.exports = function(grunt) {
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
+ 'wp-admin-rtl': {
|
|
|
+ options: {
|
|
|
+ processContent: function( src ) {
|
|
|
+ return src.replace( /\.css/g, '-rtl.css' );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ src: SOURCE_DIR + 'wp-admin/css/wp-admin.css',
|
|
|
+ dest: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.css'
|
|
|
+ },
|
|
|
version: {
|
|
|
options: {
|
|
|
processContent: function( src ) {
|
|
|
- return src.replace( /^(\$wp_version.+?)-src';/m, '$1\';' );
|
|
|
+ return src.replace( /^\$wp_version = '(.+?)';/m, function( str, version ) {
|
|
|
+ version = version.replace( /-src$/, '' );
|
|
|
+
|
|
|
+ // If the version includes an SVN commit (-12345), it's not a released alpha/beta. Append a date.
|
|
|
+ version = version.replace( /-[\d]{5}$/, '-' + grunt.template.today( 'yyyymmdd' ) );
|
|
|
+
|
|
|
+ /* jshint quotmark: true */
|
|
|
+ return "$wp_version = '" + version + "';";
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
files: [
|
|
@@ -195,7 +216,7 @@ module.exports = function(grunt) {
|
|
|
'**/*.js',
|
|
|
'!twenty{eleven,twelve,thirteen}/**',
|
|
|
// Third party scripts
|
|
|
- '!twentyfourteen/js/html5.js'
|
|
|
+ '!twenty{fourteen,fifteen}/js/html5.js'
|
|
|
]
|
|
|
},
|
|
|
core: {
|
|
@@ -213,15 +234,14 @@ module.exports = function(grunt) {
|
|
|
'wp-includes/js/tinymce/plugins/wp*/plugin.js',
|
|
|
// Third party scripts
|
|
|
'!wp-admin/js/farbtastic.js',
|
|
|
- '!wp-admin/js/iris.min.js',
|
|
|
'!wp-includes/js/backbone*.js',
|
|
|
'!wp-includes/js/swfobject.js',
|
|
|
'!wp-includes/js/underscore*.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'
|
|
|
+ '!wp-includes/js/tw-sack.js',
|
|
|
+ '!**/*.min.js'
|
|
|
],
|
|
|
// Remove once other JSHint errors are resolved
|
|
|
options: {
|
|
@@ -247,6 +267,36 @@ module.exports = function(grunt) {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ plugins: {
|
|
|
+ expand: true,
|
|
|
+ cwd: SOURCE_DIR + 'wp-content/plugins',
|
|
|
+ src: [
|
|
|
+ '**/*.js',
|
|
|
+ '!**/*.min.js'
|
|
|
+ ],
|
|
|
+ // Limit JSHint's run to a single specified plugin directory:
|
|
|
+ //
|
|
|
+ // grunt jshint:plugins --dir=foldername
|
|
|
+ //
|
|
|
+ filter: function( dirpath ) {
|
|
|
+ var index, dir = grunt.option( 'dir' );
|
|
|
+
|
|
|
+ // Don't filter when no target folder is specified
|
|
|
+ if ( ! dir ) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ dirpath = dirpath.replace( /\\/g, '/' );
|
|
|
+ index = dirpath.lastIndexOf( '/' + dir );
|
|
|
+
|
|
|
+ // Match only the folder name passed from cli
|
|
|
+ if ( -1 !== index ) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -331,8 +381,8 @@ module.exports = function(grunt) {
|
|
|
build: {
|
|
|
files: {
|
|
|
src: [
|
|
|
- BUILD_DIR + '/**/*.js',
|
|
|
- '!' + BUILD_DIR + '/wp-content/**/*.js'
|
|
|
+ BUILD_DIR + 'wp-{admin,includes}/**/*.js',
|
|
|
+ BUILD_DIR + 'wp-content/themes/twenty*/**/*.js'
|
|
|
]
|
|
|
}
|
|
|
}
|
|
@@ -362,6 +412,9 @@ module.exports = function(grunt) {
|
|
|
interval: 2000
|
|
|
}
|
|
|
},
|
|
|
+ config: {
|
|
|
+ files: 'Gruntfile.js'
|
|
|
+ },
|
|
|
colors: {
|
|
|
files: [SOURCE_DIR + 'wp-admin/css/colors/**'],
|
|
|
tasks: ['sass:colors']
|