Ticket #25159: 25159.2.patch
File 25159.2.patch, 4.6 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 banner: '// Created: <%= grunt.template.today("UTC:yyyy-mm-dd HH:MM:ss Z") %>\n', 100 process: function( src, filepath ) { 101 return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src; 102 } 103 }, 104 src: [ 105 BUILD_DIR + 'wp-includes/js/tinymce/tiny_mce.js', 106 BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce-schema.min.js', 107 BUILD_DIR + 'wp-includes/js/tinymce/themes/advanced/editor_template.js', 108 BUILD_DIR + 'wp-includes/js/tinymce/plugins/*/editor_plugin.js', 109 BUILD_DIR + 'wp-includes/js/tinymce/mark_loaded.js' 110 ], 111 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js' 112 } 113 }, 114 compress: { 115 tinymce: { 116 options: { 117 mode: 'gzip', 118 level: 9 119 }, 120 src: '<%= concat.tinymce.dest %>', 121 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz' 122 } 123 }, 85 124 watch: { 86 125 all: { 87 126 files: [ … … 105 144 grunt.loadNpmTasks('grunt-contrib-cssmin'); 106 145 grunt.loadNpmTasks('grunt-contrib-uglify'); 107 146 grunt.loadNpmTasks('grunt-contrib-watch'); 147 grunt.loadNpmTasks('grunt-contrib-compress'); 148 grunt.loadNpmTasks('grunt-contrib-concat'); 108 149 109 150 // Register tasks. 110 grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 111 'uglify: core', 'uglify:tinymce']);151 grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 'uglify:core', 152 'uglify:tinymce', 'concat:tinymce', 'compress:tinymce', 'clean:tinymce']); 112 153 113 154 // Default task. 114 155 grunt.registerTask('default', ['build']); … … 117 158 // 118 159 // On `watch:all`, automatically updates the `copy:dynamic` and `clean:dynamic` 119 160 // configurations so that only the changed files are updated. 120 grunt.event.on('watch', function(action, filepath, target) { 121 if (target != 'all') return; 161 grunt.event.on('watch', function( action, filepath, target ) { 162 if ( target != 'all' ) 163 return; 122 164 123 var relativePath = path.relative(SOURCE_DIR, filepath); 124 var cleanSrc = (action == 'deleted') ? [relativePath] : []; 125 var copySrc = (action == 'deleted') ? [] : [relativePath]; 165 var relativePath = path.relative( SOURCE_DIR, filepath ); 166 var cleanSrc = ( action == 'deleted' ) ? [relativePath] : []; 167 var copySrc = ( action == 'deleted' ) ? [] : [relativePath]; 168 126 169 grunt.config(['clean', 'dynamic', 'src'], cleanSrc); 127 170 grunt.config(['copy', 'dynamic', 'src'], copySrc); 128 171 }); -
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 }