Ticket #44492: build-into-src.5.diff
File build-into-src.5.diff, 41.3 KB (added by , 6 years ago) |
---|
-
Gruntfile.js
8 8 spawn = require( 'child_process' ).spawnSync, 9 9 SOURCE_DIR = 'src/', 10 10 BUILD_DIR = 'build/', 11 WORKING_DIR = grunt.option( 'dev' ) ? SOURCE_DIR : BUILD_DIR, 11 12 BANNER_TEXT = '/*! This file is auto-generated */', 12 13 autoprefixer = require( 'autoprefixer' ), 13 14 nodesass = require( 'node-sass' ), … … 24 25 'wp-content/plugins/index.php', 25 26 'wp-content/plugins/hello.php', 26 27 'wp-content/plugins/akismet/**' 27 ], 28 cleanFiles = [], 29 changedFiles = { 30 php: [] 31 }; 28 ]; 32 29 33 buildFiles.forEach( function( buildFile ) {34 cleanFiles.push( BUILD_DIR + buildFile );35 } );36 37 30 if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] && ! phpUnitWatchGroup ) { 38 31 grunt.log.writeln(); 39 32 grunt.fail.fatal( … … 81 74 }, 82 75 colors: { 83 76 expand: true, 84 cwd: BUILD_DIR,85 dest: BUILD_DIR,77 cwd: WORKING_DIR, 78 dest: WORKING_DIR, 86 79 src: [ 87 80 'wp-admin/css/colors/*/colors.css' 88 81 ] … … 96 89 }, 97 90 files: { 98 91 src: [ 99 BUILD_DIR + 'wp-admin/css/*.min.css',100 BUILD_DIR + 'wp-includes/css/*.min.css',101 BUILD_DIR + 'wp-admin/css/colors/*/*.css'92 WORKING_DIR + 'wp-admin/css/*.min.css', 93 WORKING_DIR + 'wp-includes/css/*.min.css', 94 WORKING_DIR + 'wp-admin/css/colors/*/*.css' 102 95 ] 103 96 } 104 97 }, … … 105 98 clean: { 106 99 plugins: [BUILD_DIR + 'wp-content/plugins'], 107 100 themes: [BUILD_DIR + 'wp-content/themes'], 108 all: [ 109 cleanFiles, 110 SOURCE_DIR + 'wp-includes/js/dist', 111 SOURCE_DIR + 'wp-includes/css/dist' 101 files: buildFiles.map( function( file ) { 102 return BUILD_DIR + file; 103 }), 104 css: [ 105 WORKING_DIR + 'wp-admin/css/*.min.css', 106 WORKING_DIR + 'wp-admin/css/*rtl*', 107 WORKING_DIR + 'wp-includes/css/*.min.css', 108 WORKING_DIR + 'wp-includes/css/*rtl*', 109 WORKING_DIR + 'wp-admin/css/colors/**/*.css' 112 110 ], 113 js: [BUILD_DIR + 'wp-admin/js/', BUILD_DIR + 'wp-includes/js/'], 111 js: [ 112 WORKING_DIR + 'wp-admin/js/', 113 WORKING_DIR + 'wp-includes/js/' 114 ], 114 115 dynamic: { 115 116 dot: true, 116 117 expand: true, 117 cwd: BUILD_DIR,118 cwd: WORKING_DIR, 118 119 src: [] 119 120 }, 120 121 tinymce: ['<%= concat.tinymce.dest %>'], … … 125 126 files: [ 126 127 { 127 128 append: 'jQuery.noConflict();', 128 input: './build/wp-includes/js/jquery/jquery.js',129 output: './build/wp-includes/js/jquery/jquery.js'129 input: WORKING_DIR + 'wp-includes/js/jquery/jquery.js', 130 output: WORKING_DIR + 'wp-includes/js/jquery/jquery.js' 130 131 } 131 132 ] 132 133 } … … 153 154 dest: BUILD_DIR 154 155 }, 155 156 { 156 'build/index.php': ['src/_index.php'],157 'build/wp-admin/index.php': ['src/wp-admin/_index.php']157 [BUILD_DIR + 'index.php']: ['src/_index.php'], 158 [BUILD_DIR + 'wp-admin/index.php']: ['src/wp-admin/_index.php'] 158 159 } 159 160 ] 160 161 }, 161 162 'npm-packages': { 162 163 files: { 163 'build/wp-includes/js/backbone.js': ['./node_modules/backbone/backbone.js'],164 'build/wp-includes/js/hoverIntent.js': ['./node_modules/jquery-hoverintent/jquery.hoverIntent.js'],165 'build/wp-includes/js/imagesloaded.min.js': ['./node_modules/imagesloaded/imagesloaded.pkgd.min.js'],166 'build/wp-includes/js/jquery/jquery-migrate.js': ['./node_modules/jquery-migrate/dist/jquery-migrate.js'],167 'build/wp-includes/js/jquery/jquery-migrate.min.js': ['./node_modules/jquery-migrate/dist/jquery-migrate.min.js'],168 'build/wp-includes/js/jquery/jquery.form.js': ['./node_modules/jquery-form/src/jquery.form.js'],169 'build/wp-includes/js/jquery/jquery.form.min.js': ['./node_modules/jquery-form/dist/jquery.form.min.js'],170 'build/wp-includes/js/jquery/jquery.js': ['./node_modules/jquery/dist/jquery.min.js'],171 'build/wp-includes/js/masonry.min.js': ['./node_modules/masonry-layout/dist/masonry.pkgd.min.js'],172 'build/wp-includes/js/twemoji.js': ['./node_modules/twemoji/2/twemoji.js'],173 'build/wp-includes/js/underscore.min.js': ['./node_modules/underscore/underscore-min.js']164 [ WORKING_DIR + 'wp-includes/js/backbone.js' ]: [ './node_modules/backbone/backbone.js' ], 165 [ WORKING_DIR + 'wp-includes/js/hoverIntent.js' ]: [ './node_modules/jquery-hoverintent/jquery.hoverIntent.js' ], 166 [ WORKING_DIR + 'wp-includes/js/imagesloaded.min.js' ]: [ './node_modules/imagesloaded/imagesloaded.pkgd.min.js' ], 167 [ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.js' ], 168 [ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.min.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.min.js' ], 169 [ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.js' ]: [ './node_modules/jquery-form/src/jquery.form.js' ], 170 [ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.min.js' ]: [ './node_modules/jquery-form/dist/jquery.form.min.js' ], 171 [ WORKING_DIR + 'wp-includes/js/jquery/jquery.js' ]: [ './node_modules/jquery/dist/jquery.min.js' ], 172 [ WORKING_DIR + 'wp-includes/js/masonry.min.js' ]: [ './node_modules/masonry-layout/dist/masonry.pkgd.min.js' ], 173 [ WORKING_DIR + 'wp-includes/js/twemoji.js' ]: [ './node_modules/twemoji/2/twemoji.js' ], 174 [ WORKING_DIR + 'wp-includes/js/underscore.min.js' ]: [ './node_modules/underscore/underscore-min.js' ] 174 175 } 175 176 }, 176 177 'vendor-js': { … … 188 189 '!jquery/jquery.masonry.js', 189 190 '!tinymce/tinymce.js' 190 191 ], 191 dest: 'build/wp-includes/js/'192 dest: WORKING_DIR + 'wp-includes/js/' 192 193 }, 193 194 { 194 195 expand: true, … … 197 198 'farbtastic.js', 198 199 'iris.min.js' 199 200 ], 200 dest: 'build/wp-admin/js/'201 dest: WORKING_DIR + 'wp-admin/js/' 201 202 }, 202 203 { 203 204 expand: true, … … 205 206 src: [ 206 207 'suggest*' 207 208 ], 208 dest: 'build/wp-includes/js/jquery/'209 dest: WORKING_DIR + 'wp-includes/js/jquery/' 209 210 } 210 211 ] 211 212 }, 212 213 'admin-js': { 213 214 files: { 214 'build/wp-admin/js/accordion.js': ['./src/js/_enqueues/lib/accordion.js'],215 'build/wp-admin/js/code-editor.js': ['./src/js/_enqueues/wp/code-editor.js'],216 'build/wp-admin/js/color-picker.js': ['./src/js/_enqueues/lib/color-picker.js'],217 'build/wp-admin/js/comment.js': ['./src/js/_enqueues/admin/comment.js'],218 'build/wp-admin/js/common.js': ['./src/js/_enqueues/admin/common.js'],219 'build/wp-admin/js/custom-background.js': ['./src/js/_enqueues/admin/custom-background.js'],220 'build/wp-admin/js/custom-header.js': ['./src/js/_enqueues/admin/custom-header.js'],221 'build/wp-admin/js/customize-controls.js': ['./src/js/_enqueues/wp/customize/controls.js'],222 'build/wp-admin/js/customize-nav-menus.js': ['./src/js/_enqueues/wp/customize/nav-menus.js'],223 'build/wp-admin/js/customize-widgets.js': ['./src/js/_enqueues/wp/customize/widgets.js'],224 'build/wp-admin/js/dashboard.js': ['./src/js/_enqueues/wp/dashboard.js'],225 'build/wp-admin/js/edit-comments.js': ['./src/js/_enqueues/admin/edit-comments.js'],226 'build/wp-admin/js/editor-expand.js': ['./src/js/_enqueues/wp/editor/dfw.js'],227 'build/wp-admin/js/editor.js': ['./src/js/_enqueues/wp/editor/base.js'],228 'build/wp-admin/js/gallery.js': ['./src/js/_enqueues/lib/gallery.js'],229 'build/wp-admin/js/image-edit.js': ['./src/js/_enqueues/lib/image-edit.js'],230 'build/wp-admin/js/inline-edit-post.js': ['./src/js/_enqueues/admin/inline-edit-post.js'],231 'build/wp-admin/js/inline-edit-tax.js': ['./src/js/_enqueues/admin/inline-edit-tax.js'],232 'build/wp-admin/js/language-chooser.js': ['./src/js/_enqueues/lib/language-chooser.js'],233 'build/wp-admin/js/link.js': ['./src/js/_enqueues/admin/link.js'],234 'build/wp-admin/js/media-gallery.js': ['./src/js/_enqueues/deprecated/media-gallery.js'],235 'build/wp-admin/js/media-upload.js': ['./src/js/_enqueues/admin/media-upload.js'],236 'build/wp-admin/js/media.js': ['./src/js/_enqueues/admin/media.js'],237 'build/wp-admin/js/nav-menu.js': ['./src/js/_enqueues/lib/nav-menu.js'],238 'build/wp-admin/js/password-strength-meter.js': ['./src/js/_enqueues/wp/password-strength-meter.js'],239 'build/wp-admin/js/plugin-install.js': ['./src/js/_enqueues/admin/plugin-install.js'],240 'build/wp-admin/js/post.js': ['./src/js/_enqueues/admin/post.js'],241 'build/wp-admin/js/postbox.js': ['./src/js/_enqueues/admin/postbox.js'],242 'build/wp-admin/js/revisions.js': ['./src/js/_enqueues/wp/revisions.js'],243 'build/wp-admin/js/set-post-thumbnail.js': ['./src/js/_enqueues/admin/set-post-thumbnail.js'],244 'build/wp-admin/js/svg-painter.js': ['./src/js/_enqueues/wp/svg-painter.js'],245 'build/wp-admin/js/tags-box.js': ['./src/js/_enqueues/admin/tags-box.js'],246 'build/wp-admin/js/tags-suggest.js': ['./src/js/_enqueues/admin/tags-suggest.js'],247 'build/wp-admin/js/tags.js': ['./src/js/_enqueues/admin/tags.js'],248 'build/wp-admin/js/theme-plugin-editor.js': ['./src/js/_enqueues/wp/theme-plugin-editor.js'],249 'build/wp-admin/js/theme.js': ['./src/js/_enqueues/wp/theme.js'],250 'build/wp-admin/js/updates.js': ['./src/js/_enqueues/wp/updates.js'],251 'build/wp-admin/js/user-profile.js': ['./src/js/_enqueues/admin/user-profile.js'],252 'build/wp-admin/js/user-suggest.js': ['./src/js/_enqueues/lib/user-suggest.js'],253 'build/wp-admin/js/widgets/custom-html-widgets.js': ['./src/js/_enqueues/wp/widgets/custom-html.js'],254 'build/wp-admin/js/widgets/media-audio-widget.js': ['./src/js/_enqueues/wp/widgets/media-audio.js'],255 'build/wp-admin/js/widgets/media-gallery-widget.js': ['./src/js/_enqueues/wp/widgets/media-gallery.js'],256 'build/wp-admin/js/widgets/media-image-widget.js': ['./src/js/_enqueues/wp/widgets/media-image.js'],257 'build/wp-admin/js/widgets/media-video-widget.js': ['./src/js/_enqueues/wp/widgets/media-video.js'],258 'build/wp-admin/js/widgets/media-widgets.js': ['./src/js/_enqueues/wp/widgets/media.js'],259 'build/wp-admin/js/widgets/text-widgets.js': ['./src/js/_enqueues/wp/widgets/text.js'],260 'build/wp-admin/js/widgets.js': ['./src/js/_enqueues/admin/widgets.js'],261 'build/wp-admin/js/word-count.js': ['./src/js/_enqueues/wp/utils/word-count.js'],262 'build/wp-admin/js/wp-fullscreen-stub.js': ['./src/js/_enqueues/deprecated/fullscreen-stub.js'],263 'build/wp-admin/js/xfn.js': ['./src/js/_enqueues/admin/xfn.js']215 [ WORKING_DIR + 'wp-admin/js/accordion.js' ]: [ './src/js/_enqueues/lib/accordion.js' ], 216 [ WORKING_DIR + 'wp-admin/js/code-editor.js' ]: [ './src/js/_enqueues/wp/code-editor.js' ], 217 [ WORKING_DIR + 'wp-admin/js/color-picker.js' ]: [ './src/js/_enqueues/lib/color-picker.js' ], 218 [ WORKING_DIR + 'wp-admin/js/comment.js' ]: [ './src/js/_enqueues/admin/comment.js' ], 219 [ WORKING_DIR + 'wp-admin/js/common.js' ]: [ './src/js/_enqueues/admin/common.js' ], 220 [ WORKING_DIR + 'wp-admin/js/custom-background.js' ]: [ './src/js/_enqueues/admin/custom-background.js' ], 221 [ WORKING_DIR + 'wp-admin/js/custom-header.js' ]: [ './src/js/_enqueues/admin/custom-header.js' ], 222 [ WORKING_DIR + 'wp-admin/js/customize-controls.js' ]: [ './src/js/_enqueues/wp/customize/controls.js' ], 223 [ WORKING_DIR + 'wp-admin/js/customize-nav-menus.js' ]: [ './src/js/_enqueues/wp/customize/nav-menus.js' ], 224 [ WORKING_DIR + 'wp-admin/js/customize-widgets.js' ]: [ './src/js/_enqueues/wp/customize/widgets.js' ], 225 [ WORKING_DIR + 'wp-admin/js/dashboard.js' ]: [ './src/js/_enqueues/wp/dashboard.js' ], 226 [ WORKING_DIR + 'wp-admin/js/edit-comments.js' ]: [ './src/js/_enqueues/admin/edit-comments.js' ], 227 [ WORKING_DIR + 'wp-admin/js/editor-expand.js' ]: [ './src/js/_enqueues/wp/editor/dfw.js' ], 228 [ WORKING_DIR + 'wp-admin/js/editor.js' ]: [ './src/js/_enqueues/wp/editor/base.js' ], 229 [ WORKING_DIR + 'wp-admin/js/gallery.js' ]: [ './src/js/_enqueues/lib/gallery.js' ], 230 [ WORKING_DIR + 'wp-admin/js/image-edit.js' ]: [ './src/js/_enqueues/lib/image-edit.js' ], 231 [ WORKING_DIR + 'wp-admin/js/inline-edit-post.js' ]: [ './src/js/_enqueues/admin/inline-edit-post.js' ], 232 [ WORKING_DIR + 'wp-admin/js/inline-edit-tax.js' ]: [ './src/js/_enqueues/admin/inline-edit-tax.js' ], 233 [ WORKING_DIR + 'wp-admin/js/language-chooser.js' ]: [ './src/js/_enqueues/lib/language-chooser.js' ], 234 [ WORKING_DIR + 'wp-admin/js/link.js' ]: [ './src/js/_enqueues/admin/link.js' ], 235 [ WORKING_DIR + 'wp-admin/js/media-gallery.js' ]: [ './src/js/_enqueues/deprecated/media-gallery.js' ], 236 [ WORKING_DIR + 'wp-admin/js/media-upload.js' ]: [ './src/js/_enqueues/admin/media-upload.js' ], 237 [ WORKING_DIR + 'wp-admin/js/media.js' ]: [ './src/js/_enqueues/admin/media.js' ], 238 [ WORKING_DIR + 'wp-admin/js/nav-menu.js' ]: [ './src/js/_enqueues/lib/nav-menu.js' ], 239 [ WORKING_DIR + 'wp-admin/js/password-strength-meter.js' ]: [ './src/js/_enqueues/wp/password-strength-meter.js' ], 240 [ WORKING_DIR + 'wp-admin/js/plugin-install.js' ]: [ './src/js/_enqueues/admin/plugin-install.js' ], 241 [ WORKING_DIR + 'wp-admin/js/post.js' ]: [ './src/js/_enqueues/admin/post.js' ], 242 [ WORKING_DIR + 'wp-admin/js/postbox.js' ]: [ './src/js/_enqueues/admin/postbox.js' ], 243 [ WORKING_DIR + 'wp-admin/js/revisions.js' ]: [ './src/js/_enqueues/wp/revisions.js' ], 244 [ WORKING_DIR + 'wp-admin/js/set-post-thumbnail.js' ]: [ './src/js/_enqueues/admin/set-post-thumbnail.js' ], 245 [ WORKING_DIR + 'wp-admin/js/svg-painter.js' ]: [ './src/js/_enqueues/wp/svg-painter.js' ], 246 [ WORKING_DIR + 'wp-admin/js/tags-box.js' ]: [ './src/js/_enqueues/admin/tags-box.js' ], 247 [ WORKING_DIR + 'wp-admin/js/tags-suggest.js' ]: [ './src/js/_enqueues/admin/tags-suggest.js' ], 248 [ WORKING_DIR + 'wp-admin/js/tags.js' ]: [ './src/js/_enqueues/admin/tags.js' ], 249 [ WORKING_DIR + 'wp-admin/js/theme-plugin-editor.js' ]: [ './src/js/_enqueues/wp/theme-plugin-editor.js' ], 250 [ WORKING_DIR + 'wp-admin/js/theme.js' ]: [ './src/js/_enqueues/wp/theme.js' ], 251 [ WORKING_DIR + 'wp-admin/js/updates.js' ]: [ './src/js/_enqueues/wp/updates.js' ], 252 [ WORKING_DIR + 'wp-admin/js/user-profile.js' ]: [ './src/js/_enqueues/admin/user-profile.js' ], 253 [ WORKING_DIR + 'wp-admin/js/user-suggest.js' ]: [ './src/js/_enqueues/lib/user-suggest.js' ], 254 [ WORKING_DIR + 'wp-admin/js/widgets/custom-html-widgets.js' ]: [ './src/js/_enqueues/wp/widgets/custom-html.js' ], 255 [ WORKING_DIR + 'wp-admin/js/widgets/media-audio-widget.js' ]: [ './src/js/_enqueues/wp/widgets/media-audio.js' ], 256 [ WORKING_DIR + 'wp-admin/js/widgets/media-gallery-widget.js' ]: [ './src/js/_enqueues/wp/widgets/media-gallery.js' ], 257 [ WORKING_DIR + 'wp-admin/js/widgets/media-image-widget.js' ]: [ './src/js/_enqueues/wp/widgets/media-image.js' ], 258 [ WORKING_DIR + 'wp-admin/js/widgets/media-video-widget.js' ]: [ './src/js/_enqueues/wp/widgets/media-video.js' ], 259 [ WORKING_DIR + 'wp-admin/js/widgets/media-widgets.js' ]: [ './src/js/_enqueues/wp/widgets/media.js' ], 260 [ WORKING_DIR + 'wp-admin/js/widgets/text-widgets.js' ]: [ './src/js/_enqueues/wp/widgets/text.js' ], 261 [ WORKING_DIR + 'wp-admin/js/widgets.js' ]: [ './src/js/_enqueues/admin/widgets.js' ], 262 [ WORKING_DIR + 'wp-admin/js/word-count.js' ]: [ './src/js/_enqueues/wp/utils/word-count.js' ], 263 [ WORKING_DIR + 'wp-admin/js/wp-fullscreen-stub.js' ]: [ './src/js/_enqueues/deprecated/fullscreen-stub.js' ], 264 [ WORKING_DIR + 'wp-admin/js/xfn.js' ]: [ './src/js/_enqueues/admin/xfn.js' ] 264 265 } 265 266 }, 266 267 'includes-js': { 267 268 files: { 268 'build/wp-includes/js/admin-bar.js': ['./src/js/_enqueues/lib/admin-bar.js'],269 'build/wp-includes/js/api-request.js': ['./src/js/_enqueues/wp/api-request.js'],270 'build/wp-includes/js/autosave.js': ['./src/js/_enqueues/wp/autosave.js'],271 'build/wp-includes/js/comment-reply.js': ['./src/js/_enqueues/lib/comment-reply.js'],272 'build/wp-includes/js/customize-base.js': ['./src/js/_enqueues/wp/customize/base.js'],273 'build/wp-includes/js/customize-loader.js': ['./src/js/_enqueues/wp/customize/loader.js'],274 'build/wp-includes/js/customize-models.js': ['./src/js/_enqueues/wp/customize/models.js'],275 'build/wp-includes/js/customize-preview-nav-menus.js': ['./src/js/_enqueues/wp/customize/preview-nav-menus.js'],276 'build/wp-includes/js/customize-preview-widgets.js': ['./src/js/_enqueues/wp/customize/preview-widgets.js'],277 'build/wp-includes/js/customize-preview.js': ['./src/js/_enqueues/wp/customize/preview.js'],278 'build/wp-includes/js/customize-selective-refresh.js': ['./src/js/_enqueues/wp/customize/selective-refresh.js'],279 'build/wp-includes/js/customize-views.js': ['./src/js/_enqueues/wp/customize/views.js'],280 'build/wp-includes/js/heartbeat.js': ['./src/js/_enqueues/wp/heartbeat.js'],281 'build/wp-includes/js/mce-view.js': ['./src/js/_enqueues/wp/mce-view.js'],282 'build/wp-includes/js/media-editor.js': ['./src/js/_enqueues/wp/media/editor.js'],283 'build/wp-includes/js/quicktags.js': ['./src/js/_enqueues/lib/quicktags.js'],284 'build/wp-includes/js/shortcode.js': ['./src/js/_enqueues/wp/shortcode.js'],285 'build/wp-includes/js/utils.js': ['./src/js/_enqueues/lib/cookies.js'],286 'build/wp-includes/js/wp-a11y.js': ['./src/js/_enqueues/wp/a11y.js'],287 'build/wp-includes/js/wp-ajax-response.js': ['./src/js/_enqueues/lib/ajax-response.js'],288 'build/wp-includes/js/wp-api.js': ['./src/js/_enqueues/wp/api.js'],289 'build/wp-includes/js/wp-auth-check.js': ['./src/js/_enqueues/lib/auth-check.js'],290 'build/wp-includes/js/wp-backbone.js': ['./src/js/_enqueues/wp/backbone.js'],291 'build/wp-includes/js/wp-custom-header.js': ['./src/js/_enqueues/wp/custom-header.js'],292 'build/wp-includes/js/wp-embed-template.js': ['./src/js/_enqueues/lib/embed-template.js'],293 'build/wp-includes/js/wp-embed.js': ['./src/js/_enqueues/wp/embed.js'],294 'build/wp-includes/js/wp-emoji-loader.js': ['./src/js/_enqueues/lib/emoji-loader.js'],295 'build/wp-includes/js/wp-emoji.js': ['./src/js/_enqueues/wp/emoji.js'],296 'build/wp-includes/js/wp-list-revisions.js': ['./src/js/_enqueues/lib/list-revisions.js'],297 'build/wp-includes/js/wp-lists.js': ['./src/js/_enqueues/lib/lists.js'],298 'build/wp-includes/js/wp-pointer.js': ['./src/js/_enqueues/lib/pointer.js'],299 'build/wp-includes/js/wp-sanitize.js': ['./src/js/_enqueues/wp/sanitize.js'],300 'build/wp-includes/js/wp-util.js': ['./src/js/_enqueues/wp/util.js'],301 'build/wp-includes/js/wpdialog.js': ['./src/js/_enqueues/lib/dialog.js'],302 'build/wp-includes/js/wplink.js': ['./src/js/_enqueues/lib/link.js'],303 'build/wp-includes/js/zxcvbn-async.js': ['./src/js/_enqueues/lib/zxcvbn-async.js']269 [ WORKING_DIR + 'wp-includes/js/admin-bar.js' ]: [ './src/js/_enqueues/lib/admin-bar.js' ], 270 [ WORKING_DIR + 'wp-includes/js/api-request.js' ]: [ './src/js/_enqueues/wp/api-request.js' ], 271 [ WORKING_DIR + 'wp-includes/js/autosave.js' ]: [ './src/js/_enqueues/wp/autosave.js' ], 272 [ WORKING_DIR + 'wp-includes/js/comment-reply.js' ]: [ './src/js/_enqueues/lib/comment-reply.js' ], 273 [ WORKING_DIR + 'wp-includes/js/customize-base.js' ]: [ './src/js/_enqueues/wp/customize/base.js' ], 274 [ WORKING_DIR + 'wp-includes/js/customize-loader.js' ]: [ './src/js/_enqueues/wp/customize/loader.js' ], 275 [ WORKING_DIR + 'wp-includes/js/customize-models.js' ]: [ './src/js/_enqueues/wp/customize/models.js' ], 276 [ WORKING_DIR + 'wp-includes/js/customize-preview-nav-menus.js' ]: [ './src/js/_enqueues/wp/customize/preview-nav-menus.js' ], 277 [ WORKING_DIR + 'wp-includes/js/customize-preview-widgets.js' ]: [ './src/js/_enqueues/wp/customize/preview-widgets.js' ], 278 [ WORKING_DIR + 'wp-includes/js/customize-preview.js' ]: [ './src/js/_enqueues/wp/customize/preview.js' ], 279 [ WORKING_DIR + 'wp-includes/js/customize-selective-refresh.js' ]: [ './src/js/_enqueues/wp/customize/selective-refresh.js' ], 280 [ WORKING_DIR + 'wp-includes/js/customize-views.js' ]: [ './src/js/_enqueues/wp/customize/views.js' ], 281 [ WORKING_DIR + 'wp-includes/js/heartbeat.js' ]: [ './src/js/_enqueues/wp/heartbeat.js' ], 282 [ WORKING_DIR + 'wp-includes/js/mce-view.js' ]: [ './src/js/_enqueues/wp/mce-view.js' ], 283 [ WORKING_DIR + 'wp-includes/js/media-editor.js' ]: [ './src/js/_enqueues/wp/media/editor.js' ], 284 [ WORKING_DIR + 'wp-includes/js/quicktags.js' ]: [ './src/js/_enqueues/lib/quicktags.js' ], 285 [ WORKING_DIR + 'wp-includes/js/shortcode.js' ]: [ './src/js/_enqueues/wp/shortcode.js' ], 286 [ WORKING_DIR + 'wp-includes/js/utils.js' ]: [ './src/js/_enqueues/lib/cookies.js' ], 287 [ WORKING_DIR + 'wp-includes/js/wp-a11y.js' ]: [ './src/js/_enqueues/wp/a11y.js' ], 288 [ WORKING_DIR + 'wp-includes/js/wp-ajax-response.js' ]: [ './src/js/_enqueues/lib/ajax-response.js' ], 289 [ WORKING_DIR + 'wp-includes/js/wp-api.js' ]: [ './src/js/_enqueues/wp/api.js' ], 290 [ WORKING_DIR + 'wp-includes/js/wp-auth-check.js' ]: [ './src/js/_enqueues/lib/auth-check.js' ], 291 [ WORKING_DIR + 'wp-includes/js/wp-backbone.js' ]: [ './src/js/_enqueues/wp/backbone.js' ], 292 [ WORKING_DIR + 'wp-includes/js/wp-custom-header.js' ]: [ './src/js/_enqueues/wp/custom-header.js' ], 293 [ WORKING_DIR + 'wp-includes/js/wp-embed-template.js' ]: [ './src/js/_enqueues/lib/embed-template.js' ], 294 [ WORKING_DIR + 'wp-includes/js/wp-embed.js' ]: [ './src/js/_enqueues/wp/embed.js' ], 295 [ WORKING_DIR + 'wp-includes/js/wp-emoji-loader.js' ]: [ './src/js/_enqueues/lib/emoji-loader.js' ], 296 [ WORKING_DIR + 'wp-includes/js/wp-emoji.js' ]: [ './src/js/_enqueues/wp/emoji.js' ], 297 [ WORKING_DIR + 'wp-includes/js/wp-list-revisions.js' ]: [ './src/js/_enqueues/lib/list-revisions.js' ], 298 [ WORKING_DIR + 'wp-includes/js/wp-lists.js' ]: [ './src/js/_enqueues/lib/lists.js' ], 299 [ WORKING_DIR + 'wp-includes/js/wp-pointer.js' ]: [ './src/js/_enqueues/lib/pointer.js' ], 300 [ WORKING_DIR + 'wp-includes/js/wp-sanitize.js' ]: [ './src/js/_enqueues/wp/sanitize.js' ], 301 [ WORKING_DIR + 'wp-includes/js/wp-util.js' ]: [ './src/js/_enqueues/wp/util.js' ], 302 [ WORKING_DIR + 'wp-includes/js/wpdialog.js' ]: [ './src/js/_enqueues/lib/dialog.js' ], 303 [ WORKING_DIR + 'wp-includes/js/wplink.js' ]: [ './src/js/_enqueues/lib/link.js' ], 304 [ WORKING_DIR + 'wp-includes/js/zxcvbn-async.js' ]: [ './src/js/_enqueues/lib/zxcvbn-async.js' ] 304 305 } 305 306 }, 306 307 'wp-admin-css-compat-rtl': { … … 310 311 } 311 312 }, 312 313 src: SOURCE_DIR + 'wp-admin/css/wp-admin.css', 313 dest: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.css'314 dest: WORKING_DIR + 'wp-admin/css/wp-admin-rtl.css' 314 315 }, 315 316 'wp-admin-css-compat-min': { 316 317 options: { … … 321 322 files: [ 322 323 { 323 324 src: SOURCE_DIR + 'wp-admin/css/wp-admin.css', 324 dest: BUILD_DIR + 'wp-admin/css/wp-admin.min.css'325 dest: WORKING_DIR + 'wp-admin/css/wp-admin.min.css' 325 326 }, 326 327 { 327 src: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.css',328 dest: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.min.css'328 src: WORKING_DIR + 'wp-admin/css/wp-admin-rtl.css', 329 dest: WORKING_DIR + 'wp-admin/css/wp-admin-rtl.min.css' 329 330 } 330 331 ] 331 332 }, … … 350 351 dot: true, 351 352 expand: true, 352 353 cwd: SOURCE_DIR, 353 dest: BUILD_DIR,354 dest: WORKING_DIR, 354 355 src: [] 355 356 }, 356 357 'dynamic-js': { … … 373 374 colors: { 374 375 expand: true, 375 376 cwd: SOURCE_DIR, 376 dest: BUILD_DIR,377 dest: WORKING_DIR, 377 378 ext: '.css', 378 379 src: ['wp-admin/css/colors/*/colors.scss'], 379 380 options: { … … 388 389 }, 389 390 core: { 390 391 expand: true, 391 cwd: BUILD_DIR,392 dest: BUILD_DIR,392 cwd: WORKING_DIR, 393 dest: WORKING_DIR, 393 394 ext: '.min.css', 394 395 src: [ 395 396 'wp-admin/css/*.css', … … 398 399 'wp-includes/js/mediaelement/wp-mediaelement.css' 399 400 ] 400 401 }, 401 dist: {402 expand: true,403 cwd: BUILD_DIR,404 dest: BUILD_DIR,405 ext: '.min.css',406 src: [407 'wp-includes/css/dist/*/*.css'408 ]409 },410 402 rtl: { 411 403 expand: true, 412 cwd: BUILD_DIR,413 dest: BUILD_DIR,404 cwd: WORKING_DIR, 405 dest: WORKING_DIR, 414 406 ext: '.min.css', 415 407 src: [ 416 408 'wp-admin/css/*-rtl.css', … … 420 412 }, 421 413 colors: { 422 414 expand: true, 423 cwd: BUILD_DIR,424 dest: BUILD_DIR,415 cwd: WORKING_DIR, 416 dest: WORKING_DIR, 425 417 ext: '.min.css', 426 418 src: [ 427 419 'wp-admin/css/colors/*/*.css' … … 484 476 core: { 485 477 expand: true, 486 478 cwd: SOURCE_DIR, 487 dest: BUILD_DIR,479 dest: WORKING_DIR, 488 480 ext: '-rtl.css', 489 481 src: [ 490 482 'wp-admin/css/*.css', … … 498 490 }, 499 491 colors: { 500 492 expand: true, 501 cwd: BUILD_DIR,502 dest: BUILD_DIR,493 cwd: WORKING_DIR, 494 dest: WORKING_DIR, 503 495 ext: '-rtl.css', 504 496 src: [ 505 497 'wp-admin/css/colors/*/colors.css' … … 508 500 dynamic: { 509 501 expand: true, 510 502 cwd: SOURCE_DIR, 511 dest: BUILD_DIR,503 dest: WORKING_DIR, 512 504 ext: '-rtl.css', 513 505 src: [] 514 506 } … … 662 654 }, 663 655 core: { 664 656 expand: true, 665 cwd: BUILD_DIR,666 dest: BUILD_DIR,657 cwd: WORKING_DIR, 658 dest: WORKING_DIR, 667 659 ext: '.min.js', 668 660 src: [ 669 661 'wp-admin/js/**/*.js', … … 690 682 } 691 683 }, 692 684 expand: true, 693 cwd: BUILD_DIR,694 dest: BUILD_DIR,685 cwd: WORKING_DIR, 686 dest: WORKING_DIR, 695 687 ext: '.min.js', 696 688 src: ['wp-includes/js/wp-embed.js'] 697 689 }, … … 702 694 }, 703 695 expand: true, 704 696 cwd: 'node_modules/jquery-ui/ui/', 705 dest: BUILD_DIR + 'wp-includes/js/jquery/ui/',697 dest: WORKING_DIR + 'wp-includes/js/jquery/ui/', 706 698 ext: '.min.js', 707 699 src: ['*.js'] 708 700 }, 709 701 imgareaselect: { 710 src: BUILD_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.js',711 dest: BUILD_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.min.js'702 src: WORKING_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.js', 703 dest: WORKING_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.min.js' 712 704 }, 713 705 dynamic: { 714 706 expand: true, 715 cwd: BUILD_DIR,716 dest: BUILD_DIR,707 cwd: WORKING_DIR, 708 dest: WORKING_DIR, 717 709 ext: '.min.js', 718 710 src: [] 719 711 } 720 712 }, 721 713 webpack: { 722 prod: webpackConfig( { environment: 'production' } ), 723 devProdTarget: webpackConfig( { environment: 'development', forceBuildTarget: 'build/wp-includes' } ), 724 dev: webpackConfig( { environment: 'development' } ), 714 prod: webpackConfig( { environment: 'production', buildTarget: WORKING_DIR } ), 715 dev: webpackConfig( { environment: 'development', buildTarget: WORKING_DIR } ), 725 716 watch: webpackConfig( { environment: 'development', watch: true } ) 726 717 }, 727 718 concat: { … … 729 720 options: { 730 721 separator: '\n', 731 722 process: function( src, filepath ) { 732 return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src;723 return '// Source: ' + filepath.replace( WORKING_DIR, '' ) + '\n' + src; 733 724 } 734 725 }, 735 726 src: [ 736 BUILD_DIR + 'wp-includes/js/tinymce/tinymce.min.js',737 BUILD_DIR + 'wp-includes/js/tinymce/themes/modern/theme.min.js',738 BUILD_DIR + 'wp-includes/js/tinymce/plugins/*/plugin.min.js'727 WORKING_DIR + 'wp-includes/js/tinymce/tinymce.min.js', 728 WORKING_DIR + 'wp-includes/js/tinymce/themes/modern/theme.min.js', 729 WORKING_DIR + 'wp-includes/js/tinymce/plugins/*/plugin.min.js' 739 730 ], 740 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js'731 dest: WORKING_DIR + 'wp-includes/js/tinymce/wp-tinymce.js' 741 732 }, 742 733 emoji: { 743 734 options: { 744 735 separator: '\n', 745 736 process: function( src, filepath ) { 746 return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src;737 return '// Source: ' + filepath.replace( WORKING_DIR, '' ) + '\n' + src; 747 738 } 748 739 }, 749 740 src: [ 750 BUILD_DIR + 'wp-includes/js/twemoji.min.js',751 BUILD_DIR + 'wp-includes/js/wp-emoji.min.js'741 WORKING_DIR + 'wp-includes/js/twemoji.min.js', 742 WORKING_DIR + 'wp-includes/js/wp-emoji.min.js' 752 743 ], 753 dest: BUILD_DIR + 'wp-includes/js/wp-emoji-release.min.js'744 dest: WORKING_DIR + 'wp-includes/js/wp-emoji-release.min.js' 754 745 } 755 746 }, 756 747 compress: { … … 760 751 level: 9 761 752 }, 762 753 src: '<%= concat.tinymce.dest %>', 763 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz'754 dest: WORKING_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz' 764 755 } 765 756 }, 766 757 patch:{ … … 961 952 build: { 962 953 files: { 963 954 src: [ 964 BUILD_DIR + 'wp-{admin,includes}/**/*.js',965 BUILD_DIR + 'wp-content/themes/twenty*/**/*.js',966 '!' + BUILD_DIR + 'wp-includes/js/dist/vendor/*.js'955 WORKING_DIR + 'wp-{admin,includes}/**/*.js', 956 WORKING_DIR + 'wp-content/themes/twenty*/**/*.js', 957 '!' + WORKING_DIR + 'wp-includes/js/dist/vendor/*.js', 967 958 ] 968 959 } 969 960 }, … … 1344 1335 1345 1336 grunt.registerTask( 'build:js', [ 1346 1337 'clean:js', 1338 'webpack:prod', 1347 1339 'webpack:dev', 1348 1340 'copy:js', 1349 1341 'file_append', … … 1353 1345 'jsvalidate:build' 1354 1346 ] ); 1355 1347 1356 grunt.registerTask( ' copy:all', [1357 'c opy:files',1348 grunt.registerTask( 'build:css', [ 1349 'clean:css', 1358 1350 'copy:wp-admin-css-compat-rtl', 1359 1351 'copy:wp-admin-css-compat-min', 1360 'copy:version',1361 'copy:js'1362 ] );1363 1364 grunt.registerTask( 'build', [1365 'clean:all',1366 'copy:all',1367 'file_append',1368 1352 'cssmin:core', 1369 1353 'colors', 1370 1354 'rtl', 1371 1355 'cssmin:rtl', 1372 1356 'cssmin:colors', 1373 'uglify:all', 1374 'build:tinymce', 1375 'concat:emoji', 1376 'includes:emoji', 1377 'includes:embed', 1378 'usebanner', 1379 'webpack:prod', 1380 'webpack:devProdTarget', 1381 'cssmin:dist', 1382 'jsvalidate:build' 1357 'usebanner' 1383 1358 ] ); 1384 1359 1360 grunt.registerTask( 'build:files', [ 1361 'clean:files', 1362 'copy:files', 1363 'copy:version', 1364 ] ); 1365 1366 grunt.registerTask( 'build', function() { 1367 if ( grunt.option( 'dev' ) ) { 1368 grunt.task.run( [ 1369 'build:js', 1370 'build:css', 1371 ] ); 1372 } else { 1373 grunt.task.run( [ 1374 'build:files', 1375 'build:js', 1376 'build:css', 1377 'includes:emoji', 1378 'includes:embed', 1379 ] ); 1380 } 1381 } ); 1382 1385 1383 grunt.registerTask( 'prerelease', [ 1386 1384 'format:php:error', 1387 1385 'precommit:php', … … 1469 1467 1470 1468 if ( minimatch.match( config.src, relative, {} ) ) { 1471 1469 dest = config.dest + relative; 1472 src = [ path.relative( BUILD_DIR, dest ) ];1470 src = [ path.relative( WORKING_DIR, dest ) ]; 1473 1471 files[ dest ] = [ filepath ]; 1474 1472 break; 1475 1473 } … … 1485 1483 // If a file in the mapping matches then set the variables for our dynamic tasks. 1486 1484 if ( dest && configs.hasOwnProperty( dest ) && configs[ dest ][0] === './' + filepath ) { 1487 1485 files[ dest ] = configs[ dest ]; 1488 src = [ path.relative( BUILD_DIR, dest ) ];1486 src = [ path.relative( WORKING_DIR, dest ) ]; 1489 1487 break; 1490 1488 } 1491 1489 } … … 1523 1521 // For javascript also minify and validate the changed file. 1524 1522 if ( target === 'js-enqueues' ) { 1525 1523 grunt.config( [ 'uglify', 'dynamic', 'src' ], src ); 1526 grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return BUILD_DIR + dir; } ) );1524 grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return WORKING_DIR + dir; } ) ); 1527 1525 } 1528 1526 // For webpack only validate the file, minification is handled by webpack itself. 1529 1527 if ( target === 'js-webpack' ) { 1530 grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return BUILD_DIR + dir; } ) );1528 grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return WORKING_DIR + dir; } ) ); 1531 1529 } 1532 1530 // For css run the rtl task on just the changed file. 1533 1531 if ( target === 'rtl' ) { -
src/index.php
1 1 <?php 2 2 3 3 /** 4 * Note: this file exists only to remind developers to run WordPress from the5 * build directory.For the real index.php that gets built and boots WordPress,4 * Note: this file exists only to remind developers to build the assets. 5 * For the real index.php that gets built and boots WordPress, 6 6 * please refer to _index.php. 7 7 */ 8 8 … … 11 11 define( 'ABSPATH', dirname( __FILE__ ) . '/' ); 12 12 } 13 13 14 if ( file_exists( ABSPATH . 'wp-includes/js/dist/edit-post.js' ) ) { 15 require_once ABSPATH . '/_index.php'; 16 return; 17 } 18 14 19 define( 'WPINC', 'wp-includes' ); 15 20 require_once( ABSPATH . WPINC . '/load.php' ); 16 21 … … 26 31 27 32 // Die with an error message 28 33 $die = sprintf( 29 /* translators: %1$s: WordPress, %2$s: src, %3$s: build */ 30 __( 'You seem to be running %1$s from the %2$s directory. %1$s needs to be built and run from the %3$s directory before we can get started.' ), 31 'WordPress', 32 '<code>src</code>', 33 '<code>build</code>' 34 /* translators: %1$s: WordPress */ 35 __( 'You are running %1$s without JavaScript and CSS files. These need to be built.' ), 36 'WordPress' 34 37 ) . '</p>'; 35 $die .= '<p>' . sprintf( 38 39 $die .= '<p>' . __( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running '); 40 $die .= '<code style="color: green;">npm install</code>.</p>'; 41 42 $die .= '<ul>'; 43 $die .= '<li>' . sprintf( 36 44 /* translators: %s: WordPress */ 37 __( 'You can build %s by running:' ), 38 'WordPress' 39 ) . '</p>'; 40 $die .= '<p><code>npm install && grunt build</code></p>'; 45 __( 'To build %s while developing run:' ), 46 'WordPress' 47 ) . '<br /><br />'; 48 $die .= '<code style="color: green;">grunt build --dev</code></li>'; 49 $die .= '<li>' . sprintf( 50 __( 'To build files automatically when changing the source files run:' ), 51 'WordPress' 52 ) . '<br /><br />'; 53 $die .= '<code style="color: green;">grunt watch</code></li>'; 54 $die .= '<li>' . sprintf( 55 __( 'To create a production build of %s run:' ), 56 'WordPress' 57 ) . '<br /><br />'; 58 $die .= '<code style="color: green;">grunt build</code></li>'; 59 $die .= '</ul>'; 60 61 41 62 $die .= '<p>' . sprintf( 42 63 /* translators: %1$s: NPM URL, %2$s: Grunt URL */ 43 64 __( 'This requires <a href="%1$s">NPM</a> and <a href="%2$s">Grunt</a>. <a href="%3$s">Read more about setting up your local development environment</a>.' ), -
src/wp-admin/index.php
1 1 <?php 2 2 3 3 /** 4 * Note: this file exists only to remind developers to run WordPress from the5 * build directory. For the real wp-admin/index.php that gets built and boots6 * the WordPress admin,please refer to wp-admin/_index.php.4 * Note: this file exists only to remind developers to build the assets. 5 * For the real wp-admin/index.php that gets built and boots WordPress, 6 * please refer to wp-admin/_index.php. 7 7 */ 8 8 9 if ( file_exists( dirname( __FILE__ ) . '/../wp-includes/js/dist/edit-post.js' ) ) { 10 require_once dirname( __FILE__ ) . '/_index.php'; 11 return; 12 } 13 9 14 /** Define ABSPATH as this file's directory */ 10 15 if ( ! defined( 'ABSPATH' ) ) { 11 16 define( 'ABSPATH', dirname( __FILE__ ) . '/../' ); … … 26 31 27 32 // Die with an error message 28 33 $die = sprintf( 29 /* translators: %1$s: WordPress, %2$s: src, %3$s: build */ 30 __( 'You seem to be running %1$s from the %2$s directory. %1$s needs to be built and run from the %3$s directory before we can get started.' ), 31 'WordPress', 32 '<code>src</code>', 33 '<code>build</code>' 34 /* translators: %1$s: WordPress */ 35 __( 'You are running %1$s without JavaScript and CSS files. These need to be built.' ), 36 'WordPress' 34 37 ) . '</p>'; 35 $die .= '<p>' . sprintf( 38 39 $die .= '<p>' . __( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running '); 40 $die .= '<code style="color: green;">npm install</code>.</p>'; 41 42 $die .= '<ul>'; 43 $die .= '<li>' . sprintf( 36 44 /* translators: %s: WordPress */ 37 __( 'You can build %s by running:' ), 38 'WordPress' 39 ) . '</p>'; 40 $die .= '<p><code>npm install && grunt build</code></p>'; 45 __( 'To build %s while developing run:' ), 46 'WordPress' 47 ) . '<br /><br />'; 48 $die .= '<code style="color: green;">grunt build --dev</code></li>'; 49 $die .= '<li>' . sprintf( 50 __( 'To build files automatically when changing the source files run:' ), 51 'WordPress' 52 ) . '<br /><br />'; 53 $die .= '<code style="color: green;">grunt watch</code></li>'; 54 $die .= '<li>' . sprintf( 55 __( 'To create a production build of %s run:' ), 56 'WordPress' 57 ) . '<br /><br />'; 58 $die .= '<code style="color: green;">grunt build</code></li>'; 59 $die .= '</ul>'; 60 61 41 62 $die .= '<p>' . sprintf( 42 63 /* translators: %1$s: NPM URL, %2$s: Grunt URL */ 43 __( 'This requires <a href="%1$s">NPM</a> and <a href="%2$s">Grunt</a>. <a href="%3$s">Read more about setting up your local development environment</a>.' ),44 'https://www.npmjs.com/',45 'https://gruntjs.com/',46 __( 'https://make.wordpress.org/core/handbook/tutorials/installing-wordpress-locally/' )47 ) . '</p>';64 __( 'This requires <a href="%1$s">NPM</a> and <a href="%2$s">Grunt</a>. <a href="%3$s">Read more about setting up your local development environment</a>.' ), 65 'https://www.npmjs.com/', 66 'https://gruntjs.com/', 67 __( 'https://make.wordpress.org/core/handbook/tutorials/installing-wordpress-locally/' ) 68 ) . '</p>'; 48 69 49 70 wp_die( $die, __( 'WordPress › Error' ) ); -
tools/webpack/media.js
1 1 const UglifyJsPlugin = require( 'uglifyjs-webpack-plugin' ); 2 2 3 3 var path = require( 'path' ), 4 admin_files = {}, 5 include_files = {}; 4 admin_files = {}; 6 5 7 include_files = {8 'build/wp-includes/js/media-audiovideo.js': ['./src/js/_enqueues/wp/media/audiovideo.js'],9 'build/wp-includes/js/media-audiovideo.min.js': ['./src/js/_enqueues/wp/media/audiovideo.js'],10 'build/wp-includes/js/media-grid.js': ['./src/js/_enqueues/wp/media/grid.js'],11 'build/wp-includes/js/media-grid.min.js': ['./src/js/_enqueues/wp/media/grid.js'],12 'build/wp-includes/js/media-models.js': ['./src/js/_enqueues/wp/media/models.js'],13 'build/wp-includes/js/media-models.min.js': ['./src/js/_enqueues/wp/media/models.js'],14 'build/wp-includes/js/media-views.js': ['./src/js/_enqueues/wp/media/views.js'],15 'build/wp-includes/js/media-views.min.js': ['./src/js/_enqueues/wp/media/views.js'],16 };17 18 6 const baseDir = path.join( __dirname, '../../' ); 19 7 20 module.exports = function( env = { environment: 'production', watch: false } ) { 8 module.exports = function( env = { environment: 'production', watch: false, buildTarget: false } ) { 9 const include_files = { 10 [ env.buildTarget + 'wp-includes/js/media-audiovideo.js' ]: ['./src/js/_enqueues/wp/media/audiovideo.js'], 11 [ env.buildTarget + 'wp-includes/js/media-audiovideo.min.js' ]: ['./src/js/_enqueues/wp/media/audiovideo.js'], 12 [ env.buildTarget + 'wp-includes/js/media-grid.js' ]: ['./src/js/_enqueues/wp/media/grid.js'], 13 [ env.buildTarget + 'wp-includes/js/media-grid.min.js' ]: ['./src/js/_enqueues/wp/media/grid.js'], 14 [ env.buildTarget + 'wp-includes/js/media-models.js' ]: ['./src/js/_enqueues/wp/media/models.js'], 15 [ env.buildTarget + 'wp-includes/js/media-models.min.js' ]: ['./src/js/_enqueues/wp/media/models.js'], 16 [ env.buildTarget + 'wp-includes/js/media-views.js' ]: ['./src/js/_enqueues/wp/media/views.js'], 17 [ env.buildTarget + 'wp-includes/js/media-views.min.js' ]: ['./src/js/_enqueues/wp/media/views.js'], 18 }; 21 19 22 20 const mediaConfig = { 23 21 mode: "production", -
tools/webpack/packages.js
49 49 } ) ); 50 50 } 51 51 52 module.exports = function( env = { environment: 'production', watch: false, forceBuildTarget: false } ) {52 module.exports = function( env = { environment: 'production', watch: false, buildTarget: false } ) { 53 53 const mode = env.environment; 54 54 const suffix = mode === 'production' ? '.min' : ''; 55 const buildTarget = env.forceBuildTarget ? env.forceBuildTarget : ( mode === 'production' ? 'build' : 'src' ) + '/wp-includes'; 55 let buildTarget = env.buildTarget ? env.buildTarget : ( mode === 'production' ? 'build' : 'src' ); 56 buildTarget = buildTarget + '/wp-includes'; 56 57 57 58 const packages = [ 58 59 'api-fetch', … … 165 166 to: join( baseDir, `${ buildTarget }/css/dist/${ packageName }/` ), 166 167 flatten: true, 167 168 transform: ( content ) => { 168 if ( config.mode === 'production' && ! env.forceBuildTarget) {169 if ( mode === 'production' ) { 169 170 return postcss( [ 170 171 require( 'cssnano' )( { 171 172 preset: 'default', … … 176 177 } 177 178 178 179 return content; 180 }, 181 transformPath: ( targetPath, sourcePath ) => { 182 if ( mode === 'production' ) { 183 return targetPath.replace( /\.css$/, '.min.css' ); 184 } 185 186 return targetPath; 179 187 } 180 188 } ) ); 181 189 … … 268 276 config.devtool = process.env.SOURCEMAP || 'source-map'; 269 277 } 270 278 271 if ( env.forceBuildTarget) {279 if ( mode === 'development' && env.buildTarget === 'build/' ) { 272 280 delete config.devtool; 273 281 config.mode = 'production'; 274 282 config.optimization = { -
webpack.config.js
1 1 const mediaConfig = require( './tools/webpack/media' ); 2 2 const packagesConfig = require( './tools/webpack/packages' ); 3 3 4 module.exports = function( env = { environment: "production", watch: false, forceBuildTarget: false } ) {4 module.exports = function( env = { environment: "production", watch: false, buildTarget: false } ) { 5 5 if ( ! env.watch ) { 6 6 env.watch = false; 7 7 } 8 8 9 if ( ! env. forceBuildTarget ) {10 env. forceBuildTarget = false;9 if ( ! env.buildTarget ) { 10 env.buildTarget = ( env.mode === 'production' ? 'build/' : 'src/' ); 11 11 } 12 12 13 13 const config = [