Ticket #25159: 25159.3.patch
File 25159.3.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: { … … 68 75 'wp-includes/js/plupload/handlers.js', 69 76 'wp-includes/js/plupload/wp-plupload.js', 70 77 'wp-includes/js/tinymce/plugins/wp*/js/*.js', 78 'wp-includes/js/tinymce/wp-tinymce-schema.js', 71 79 // Exceptions 72 80 '!wp-admin/js/custom-header.js', // Why? We should minify this. 73 81 '!wp-admin/js/farbtastic.js', … … 75 83 '!wp-includes/js/backbone.min.js', 76 84 '!wp-includes/js/swfobject.js', 77 85 '!wp-includes/js/underscore.min.js', 78 '!wp-includes/js/zxcvbn.min.js' 86 '!wp-includes/js/zxcvbn.min.js', 87 '!wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js' // Hard-coded in the static html file 79 88 ] 80 89 }, 81 90 tinymce: { … … 84 93 dest: BUILD_DIR, 85 94 src: [ 86 95 'wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js', 87 'wp-includes/js/tinymce/plugins/wp*/editor_plugin_src.js' 96 'wp-includes/js/tinymce/plugins/wp*/editor_plugin_src.js', 97 'wp-includes/js/tinymce/mark_loaded_src.js' 88 98 ], 89 99 // TinyMCE plugins use a nonstandard naming scheme: plugin files are named 90 100 // `editor_plugin_src.js`, and are compressed into `editor_plugin.js`. 91 101 rename: function(destBase, destPath) { 92 destPath = destPath.replace( '/editor_plugin_src.js', '/editor_plugin.js');102 destPath = destPath.replace(/_src.js$/, '.js'); 93 103 return path.join(destBase || '', destPath); 94 104 } 95 105 } 96 106 }, 107 concat: { 108 tinymce: { 109 options: { 110 separator: '\n', 111 banner: '// Created: <%= grunt.template.today("UTC:yyyy-mm-dd HH:MM:ss Z") %>\n', 112 process: function( src, filepath ) { 113 return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src; 114 } 115 }, 116 src: [ 117 BUILD_DIR + 'wp-includes/js/tinymce/tiny_mce.js', 118 BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce-schema.min.js', 119 BUILD_DIR + 'wp-includes/js/tinymce/themes/advanced/editor_template.js', 120 BUILD_DIR + 'wp-includes/js/tinymce/plugins/*/editor_plugin.js', 121 BUILD_DIR + 'wp-includes/js/tinymce/mark_loaded.js' 122 ], 123 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js' 124 } 125 }, 126 compress: { 127 tinymce: { 128 options: { 129 mode: 'gzip', 130 level: 9 131 }, 132 src: '<%= concat.tinymce.dest %>', 133 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz' 134 } 135 }, 97 136 watch: { 98 137 all: { 99 138 files: [ … … 122 161 grunt.loadNpmTasks('grunt-contrib-qunit'); 123 162 grunt.loadNpmTasks('grunt-contrib-uglify'); 124 163 grunt.loadNpmTasks('grunt-contrib-watch'); 164 grunt.loadNpmTasks('grunt-contrib-compress'); 165 grunt.loadNpmTasks('grunt-contrib-concat'); 125 166 126 167 // Register tasks. 127 grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 128 'uglify: core', 'uglify:tinymce']);168 grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 'uglify:core', 169 'uglify:tinymce', 'concat:tinymce', 'compress:tinymce', 'clean:tinymce']); 129 170 130 171 // Testing task. 131 172 grunt.registerTask('test', ['qunit']); … … 137 178 // 138 179 // On `watch:all`, automatically updates the `copy:dynamic` and `clean:dynamic` 139 180 // configurations so that only the changed files are updated. 140 grunt.event.on('watch', function(action, filepath, target) { 141 if (target != 'all') return; 181 grunt.event.on('watch', function( action, filepath, target ) { 182 if ( target != 'all' ) 183 return; 142 184 143 var relativePath = path.relative(SOURCE_DIR, filepath); 144 var cleanSrc = (action == 'deleted') ? [relativePath] : []; 145 var copySrc = (action == 'deleted') ? [] : [relativePath]; 185 var relativePath = path.relative( SOURCE_DIR, filepath ); 186 var cleanSrc = ( action == 'deleted' ) ? [relativePath] : []; 187 var copySrc = ( action == 'deleted' ) ? [] : [relativePath]; 188 146 189 grunt.config(['clean', 'dynamic', 'src'], cleanSrc); 147 190 grunt.config(['copy', 'dynamic', 'src'], copySrc); 148 191 }); -
package.json
15 15 "grunt-contrib-cssmin": "~0.6.1", 16 16 "grunt-contrib-qunit": "~0.2.2", 17 17 "grunt-contrib-uglify": "~0.2.2", 18 "grunt-contrib-watch": "~0.5.1" 18 "grunt-contrib-watch": "~0.5.1", 19 "grunt-contrib-compress": "~0.5.2", 20 "grunt-contrib-concat": "~0.3.0" 19 21 } 20 22 }