Ticket #25159: 25159.patch
File 25159.patch, 4.4 KB (added by , 11 years ago) |
---|
-
Gruntfile.js
14 14 cwd: BUILD_DIR, 15 15 src: [] 16 16 }, 17 tinymce: { 18 src: [ 19 '<%= concat.tinymce.dest %>', 20 BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce-schema.min.js', 21 BUILD_DIR + 'wp-includes/js/tinymce/mark_loaded.js' 22 ] 23 } 17 24 }, 18 25 copy: { 19 26 all: { … … 57 64 'wp-includes/js/plupload/handlers.js', 58 65 'wp-includes/js/plupload/wp-plupload.js', 59 66 'wp-includes/js/tinymce/plugins/wp*/js/*.js', 67 'wp-includes/js/tinymce/wp-tinymce-schema.js', 60 68 // Exceptions 61 69 '!wp-admin/js/custom-header.js', // Why? We should minify this. 62 70 '!wp-admin/js/farbtastic.js', … … 63 71 '!wp-admin/js/iris.min.js', 64 72 '!wp-includes/js/backbone.min.js', 65 73 '!wp-includes/js/swfobject.js', 66 '!wp-includes/js/underscore.min.js' 74 '!wp-includes/js/underscore.min.js', 75 '!wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js' // Hard-coded in the static html file 67 76 ] 68 77 }, 69 78 tinymce: { … … 72 81 dest: BUILD_DIR, 73 82 src: [ 74 83 'wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js', 75 'wp-includes/js/tinymce/plugins/wp*/editor_plugin_src.js' 84 'wp-includes/js/tinymce/plugins/wp*/editor_plugin_src.js', 85 'wp-includes/js/tinymce/mark_loaded_src.js' 76 86 ], 77 87 // TinyMCE plugins use a nonstandard naming scheme: plugin files are named 78 88 // `editor_plugin_src.js`, and are compressed into `editor_plugin.js`. 79 89 rename: function(destBase, destPath) { 80 destPath = destPath.replace( '/editor_plugin_src.js', '/editor_plugin.js');90 destPath = destPath.replace(/_src.js$/, '.js'); 81 91 return path.join(destBase || '', destPath); 82 92 } 83 93 } 84 94 }, 95 concat: { 96 tinymce: { 97 options: { 98 separator: '\n' 99 }, 100 src: [ 101 BUILD_DIR + 'wp-includes/js/tinymce/tiny_mce.js', 102 BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce-schema.min.js', 103 BUILD_DIR + 'wp-includes/js/tinymce/themes/advanced/editor_template.js', 104 BUILD_DIR + 'wp-includes/js/tinymce/plugins/*/editor_plugin.js', 105 BUILD_DIR + 'wp-includes/js/tinymce/mark_loaded.js' 106 ], 107 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js' 108 } 109 }, 110 compress: { 111 tinymce: { 112 options: { 113 mode: 'gzip', 114 level: 9 115 }, 116 src: '<%= concat.tinymce.dest %>', 117 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz' 118 } 119 }, 85 120 watch: { 86 121 all: { 87 122 files: [ … … 105 140 grunt.loadNpmTasks('grunt-contrib-cssmin'); 106 141 grunt.loadNpmTasks('grunt-contrib-uglify'); 107 142 grunt.loadNpmTasks('grunt-contrib-watch'); 143 grunt.loadNpmTasks('grunt-contrib-compress'); 144 grunt.loadNpmTasks('grunt-contrib-concat'); 108 145 109 146 // Register tasks. 110 grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 111 'uglify: core', 'uglify:tinymce']);147 grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 'uglify:core', 148 'uglify:tinymce', 'concat:tinymce', 'compress:tinymce', 'clean:tinymce']); 112 149 113 150 // Default task. 114 151 grunt.registerTask('default', ['build']); … … 117 154 // 118 155 // On `watch:all`, automatically updates the `copy:dynamic` and `clean:dynamic` 119 156 // configurations so that only the changed files are updated. 120 grunt.event.on('watch', function(action, filepath, target) { 121 if (target != 'all') return; 157 grunt.event.on('watch', function( action, filepath, target ) { 158 if ( target != 'all' ) 159 return; 122 160 123 var relativePath = path.relative(SOURCE_DIR, filepath); 124 var cleanSrc = (action == 'deleted') ? [relativePath] : []; 125 var copySrc = (action == 'deleted') ? [] : [relativePath]; 161 var relativePath = path.relative( SOURCE_DIR, filepath ); 162 var cleanSrc = ( action == 'deleted' ) ? [relativePath] : []; 163 var copySrc = ( action == 'deleted' ) ? [] : [relativePath]; 164 126 165 grunt.config(['clean', 'dynamic', 'src'], cleanSrc); 127 166 grunt.config(['copy', 'dynamic', 'src'], copySrc); 128 167 }); -
package.json
14 14 "grunt-contrib-copy": "~0.4.1", 15 15 "grunt-contrib-cssmin": "~0.6.1", 16 16 "grunt-contrib-uglify": "~0.2.2", 17 "grunt-contrib-watch": "~0.5.1" 17 "grunt-contrib-watch": "~0.5.1", 18 "grunt-contrib-compress": "~0.5.2", 19 "grunt-contrib-concat": "~0.3.0" 18 20 } 19 21 }