WordPress.org

Make WordPress Core

Changeset 44359


Ignore:
Timestamp:
12/24/2018 01:28:22 PM (12 months ago)
Author:
atimmer
Message:

Build tools: Allow building WordPress to src.

After the JavaScript reorganization in [43309], it was no longer possible to test WordPress from the src folder. That meant a build step was required to test PHP modifications. That is suboptimal as even a simple copy is slower than a web server just serving the new file.

We achieve building to src by setting a WORKING_DIR constant in the Gruntfile that is build by default, but changes to src when the --dev flag is present on any Grunt command. We provide sensible defaults so some commands, such as copying version.php, always build to build.

Because testing from build is no longer required, we change the messages present in index.php and wp-admin/index.php to be more broadly about building WordPress.

We also change the webpack config to have more straightforward behavior based on the buildTarget argument. It only determines the build target now and has no implicit behavior anymore. grunt build still works as it worked before, to make sure that the build server produces the same wordpress.zip we are used to.

We do all this instead of a symlink setup because symlinks don't work on every platform.

Props omarreiss, netweb, flixos90, SergeyBiryukov.
Fixes #44492.

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/.gitignore

    r44285 r44359  
    2222/src/wp-includes/js
    2323/src/wp-includes/css/dist
     24/src/wp-admin/css/*.min.css
     25/src/wp-admin/css/*-rtl.css
     26/src/wp-includes/css/*.min.css
     27/src/wp-admin/css/colors/*/*.css
    2428
    2529# Files and folders that get created in wp-content
  • trunk/Gruntfile.js

    r44356 r44359  
    99        SOURCE_DIR = 'src/',
    1010        BUILD_DIR = 'build/',
     11        WORKING_DIR = grunt.option( 'dev' ) ? SOURCE_DIR : BUILD_DIR,
    1112        BANNER_TEXT = '/*! This file is auto-generated */',
    1213        autoprefixer = require( 'autoprefixer' ),
     
    2526            'wp-content/plugins/hello.php',
    2627            'wp-content/plugins/akismet/**'
    27         ],
    28         cleanFiles = [],
    29         changedFiles = {
    30             php: []
    31         };
    32 
    33     buildFiles.forEach( function( buildFile ) {
    34         cleanFiles.push( BUILD_DIR + buildFile );
    35     } );
     28        ];
    3629
    3730    if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] && ! phpUnitWatchGroup ) {
     
    8275            colors: {
    8376                expand: true,
    84                 cwd: BUILD_DIR,
    85                 dest: BUILD_DIR,
     77                cwd: WORKING_DIR,
     78                dest: WORKING_DIR,
    8679                src: [
    8780                    'wp-admin/css/colors/*/colors.css'
     
    9790            files: {
    9891                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'
    10295                ]
    10396            }
     
    10699            plugins: [BUILD_DIR + 'wp-content/plugins'],
    107100            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'
    112110            ],
    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            ],
    114115            dynamic: {
    115116                dot: true,
    116117                expand: true,
    117                 cwd: BUILD_DIR,
     118                cwd: WORKING_DIR,
    118119                src: []
    119120            },
     
    126127                    {
    127128                        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'
    130131                    }
    131132                ]
     
    154155                    },
    155156                    {
    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']
    158159                    }
    159160                ]
     
    161162            'npm-packages': {
    162163                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' ]
    174175                }
    175176            },
     
    189190                            '!tinymce/tinymce.js'
    190191                        ],
    191                         dest: 'build/wp-includes/js/'
     192                        dest: WORKING_DIR + 'wp-includes/js/'
    192193                    },
    193194                    {
     
    198199                            'iris.min.js'
    199200                        ],
    200                         dest: 'build/wp-admin/js/'
     201                        dest: WORKING_DIR + 'wp-admin/js/'
    201202                    },
    202203                    {
     
    206207                            'suggest*'
    207208                        ],
    208                         dest: 'build/wp-includes/js/jquery/'
     209                        dest: WORKING_DIR + 'wp-includes/js/jquery/'
    209210                    }
    210211                ]
     
    212213            'admin-js': {
    213214                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' ]
    264265                }
    265266            },
    266267            'includes-js': {
    267268                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' ]
    304305                }
    305306            },
     
    311312                },
    312313                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'
    314315            },
    315316            'wp-admin-css-compat-min': {
     
    322323                    {
    323324                        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'
    325326                    },
    326327                    {
    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'
    329330                    }
    330331                ]
     
    351352                expand: true,
    352353                cwd: SOURCE_DIR,
    353                 dest: BUILD_DIR,
     354                dest: WORKING_DIR,
    354355                src: []
    355356            },
     
    374375                expand: true,
    375376                cwd: SOURCE_DIR,
    376                 dest: BUILD_DIR,
     377                dest: WORKING_DIR,
    377378                ext: '.css',
    378379                src: ['wp-admin/css/colors/*/colors.scss'],
     
    389390            core: {
    390391                expand: true,
    391                 cwd: BUILD_DIR,
    392                 dest: BUILD_DIR,
     392                cwd: WORKING_DIR,
     393                dest: WORKING_DIR,
    393394                ext: '.min.css',
    394395                src: [
     
    399400                ]
    400401            },
    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             },
    410402            rtl: {
    411403                expand: true,
    412                 cwd: BUILD_DIR,
    413                 dest: BUILD_DIR,
     404                cwd: WORKING_DIR,
     405                dest: WORKING_DIR,
    414406                ext: '.min.css',
    415407                src: [
     
    421413            colors: {
    422414                expand: true,
    423                 cwd: BUILD_DIR,
    424                 dest: BUILD_DIR,
     415                cwd: WORKING_DIR,
     416                dest: WORKING_DIR,
    425417                ext: '.min.css',
    426418                src: [
     
    485477                expand: true,
    486478                cwd: SOURCE_DIR,
    487                 dest: BUILD_DIR,
     479                dest: WORKING_DIR,
    488480                ext: '-rtl.css',
    489481                src: [
     
    499491            colors: {
    500492                expand: true,
    501                 cwd: BUILD_DIR,
    502                 dest: BUILD_DIR,
     493                cwd: WORKING_DIR,
     494                dest: WORKING_DIR,
    503495                ext: '-rtl.css',
    504496                src: [
     
    509501                expand: true,
    510502                cwd: SOURCE_DIR,
    511                 dest: BUILD_DIR,
     503                dest: WORKING_DIR,
    512504                ext: '-rtl.css',
    513505                src: []
     
    663655            core: {
    664656                expand: true,
    665                 cwd: BUILD_DIR,
    666                 dest: BUILD_DIR,
     657                cwd: WORKING_DIR,
     658                dest: WORKING_DIR,
    667659                ext: '.min.js',
    668660                src: [
     
    691683                },
    692684                expand: true,
    693                 cwd: BUILD_DIR,
    694                 dest: BUILD_DIR,
     685                cwd: WORKING_DIR,
     686                dest: WORKING_DIR,
    695687                ext: '.min.js',
    696688                src: ['wp-includes/js/wp-embed.js']
     
    703695                expand: true,
    704696                cwd: 'node_modules/jquery-ui/ui/',
    705                 dest: BUILD_DIR + 'wp-includes/js/jquery/ui/',
     697                dest: WORKING_DIR + 'wp-includes/js/jquery/ui/',
    706698                ext: '.min.js',
    707699                src: ['*.js']
    708700            },
    709701            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'
    712704            },
    713705            dynamic: {
    714706                expand: true,
    715                 cwd: BUILD_DIR,
    716                 dest: BUILD_DIR,
     707                cwd: WORKING_DIR,
     708                dest: WORKING_DIR,
    717709                ext: '.min.js',
    718710                src: []
     
    720712        },
    721713        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 } ),
    725716            watch: webpackConfig( { environment: 'development', watch: true } )
    726717        },
     
    730721                    separator: '\n',
    731722                    process: function( src, filepath ) {
    732                         return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src;
     723                        return '// Source: ' + filepath.replace( WORKING_DIR, '' ) + '\n' + src;
    733724                    }
    734725                },
    735726                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'
    739730                ],
    740                 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js'
     731                dest: WORKING_DIR + 'wp-includes/js/tinymce/wp-tinymce.js'
    741732            },
    742733            emoji: {
     
    744735                    separator: '\n',
    745736                    process: function( src, filepath ) {
    746                         return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src;
     737                        return '// Source: ' + filepath.replace( WORKING_DIR, '' ) + '\n' + src;
    747738                    }
    748739                },
    749740                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'
    752743                ],
    753                 dest: BUILD_DIR + 'wp-includes/js/wp-emoji-release.min.js'
     744                dest: WORKING_DIR + 'wp-includes/js/wp-emoji-release.min.js'
    754745            }
    755746        },
     
    761752                },
    762753                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'
    764755            }
    765756        },
     
    962953                files: {
    963954                    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',
    967958                    ]
    968959                }
     
    13451336    grunt.registerTask( 'build:js', [
    13461337        'clean:js',
     1338        'webpack:prod',
    13471339        'webpack:dev',
    13481340        'copy:js',
     
    13541346    ] );
    13551347
    1356     grunt.registerTask( 'copy:all', [
    1357         'copy:files',
     1348    grunt.registerTask( 'build:css', [
     1349        'clean:css',
    13581350        'copy:wp-admin-css-compat-rtl',
    13591351        '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',
    13681352        'cssmin:core',
    13691353        'colors',
     
    13711355        'cssmin:rtl',
    13721356        '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'
    13831358    ] );
     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    } );
    13841382
    13851383    grunt.registerTask( 'prerelease', [
     
    14701468                    if ( minimatch.match( config.src, relative, {} ) ) {
    14711469                        dest = config.dest + relative;
    1472                         src = [ path.relative( BUILD_DIR, dest ) ];
     1470                        src = [ path.relative( WORKING_DIR, dest ) ];
    14731471                        files[ dest ] = [ filepath ];
    14741472                        break;
     
    14861484                    if ( dest && configs.hasOwnProperty( dest ) && configs[ dest ][0] === './' + filepath ) {
    14871485                        files[ dest ] = configs[ dest ];
    1488                         src = [ path.relative( BUILD_DIR, dest ) ];
     1486                        src = [ path.relative( WORKING_DIR, dest ) ];
    14891487                        break;
    14901488                    }
     
    15241522            if ( target === 'js-enqueues' ) {
    15251523                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; } ) );
    15271525            }
    15281526            // For webpack only validate the file, minification is handled by webpack itself.
    15291527            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; } ) );
    15311529            }
    15321530            // For css run the rtl task on just the changed file.
  • trunk/package-lock.json

    r44356 r44359  
    25092509        "browserify-rsa": {
    25102510            "version": "4.0.1",
    2511             "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz",
     2511            "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz",
    25122512            "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=",
    25132513            "dev": true,
     
    28422842        "chalk": {
    28432843            "version": "1.1.3",
    2844             "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
     2844            "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
    28452845            "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
    28462846            "requires": {
     
    50505050        "events": {
    50515051            "version": "1.1.1",
    5052             "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
     5052            "resolved": "http://registry.npmjs.org/events/-/events-1.1.1.tgz",
    50535053            "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=",
    50545054            "dev": true
     
    1112111121        "onetime": {
    1112211122            "version": "1.1.0",
    11123             "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz",
     11123            "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz",
    1112411124            "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=",
    1112511125            "dev": true
     
    1120111201        "os-locale": {
    1120211202            "version": "1.4.0",
    11203             "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
     11203            "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
    1120411204            "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
    1120511205            "dev": true,
     
    1299812998        "regjsgen": {
    1299912999            "version": "0.2.0",
    13000             "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz",
     13000            "resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz",
    1300113001            "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc="
    1300213002        },
     
    1358013580                "source-map": {
    1358113581                    "version": "0.4.4",
    13582                     "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz",
     13582                    "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz",
    1358313583                    "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=",
    1358413584                    "dev": true,
  • trunk/src/index.php

    r43571 r44359  
    22
    33/**
    4  * Note: this file exists only to remind developers to run WordPress from the
    5  * 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,
    66 * please refer to _index.php.
    77 */
     
    1010if ( ! defined( 'ABSPATH' ) ) {
    1111    define( 'ABSPATH', dirname( __FILE__ ) . '/' );
     12}
     13
     14if ( file_exists( ABSPATH . 'wp-includes/js/dist/edit-post.js' ) ) {
     15    require_once ABSPATH . '/_index.php';
     16    return;
    1217}
    1318
     
    2732// Die with an error message
    2833$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 ) . '</p>';
    35 $die .= '<p>' . sprintf(
    36     /* translators: %s: WordPress */
    37     __( 'You can build %s by running:' ),
     34    /* translators: %1$s: WordPress */
     35    __( 'You are running %1$s without JavaScript and CSS files. These need to be built.' ),
    3836    'WordPress'
    3937) . '</p>';
    40 $die .= '<p><code>npm install && grunt build</code></p>';
     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(
     44    /* translators: %s: WordPress */
     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
    4162$die .= '<p>' . sprintf(
    4263    /* translators: %1$s: NPM URL, %2$s: Grunt URL */
  • trunk/src/wp-admin

    • Property svn:ignore set to
      js
  • trunk/src/wp-admin/css

    • Property svn:ignore set to
      *.min.css
      *-rtl.css
  • trunk/src/wp-admin/css/colors/blue

    • Property svn:ignore set to
      *.css
  • trunk/src/wp-admin/css/colors/coffee

    • Property svn:ignore set to
      *.css
  • trunk/src/wp-admin/css/colors/ectoplasm

    • Property svn:ignore set to
      *.css
  • trunk/src/wp-admin/css/colors/light

    • Property svn:ignore set to
      *.css
  • trunk/src/wp-admin/css/colors/midnight

    • Property svn:ignore set to
      *.css
  • trunk/src/wp-admin/css/colors/ocean

    • Property svn:ignore set to
      *.css
  • trunk/src/wp-admin/css/colors/sunrise

    • Property svn:ignore set to
      *.css
  • trunk/src/wp-admin/index.php

    r43571 r44359  
    22
    33/**
    4  * Note: this file exists only to remind developers to run WordPress from the
    5  * build directory. For the real wp-admin/index.php that gets built and boots
    6  * 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.
    77 */
     8
     9if ( file_exists( dirname( __FILE__ ) . '/../wp-includes/js/dist/edit-post.js' ) ) {
     10    require_once dirname( __FILE__ ) . '/_index.php';
     11    return;
     12}
    813
    914/** Define ABSPATH as this file's directory */
     
    2732// Die with an error message
    2833$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 ) . '</p>';
    35 $die .= '<p>' . sprintf(
    36     /* translators: %s: WordPress */
    37     __( 'You can build %s by running:' ),
     34    /* translators: %1$s: WordPress */
     35    __( 'You are running %1$s without JavaScript and CSS files. These need to be built.' ),
    3836    'WordPress'
    3937) . '</p>';
    40 $die .= '<p><code>npm install && grunt build</code></p>';
     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(
     44    /* translators: %s: WordPress */
     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
    4162$die .= '<p>' . sprintf(
    4263    /* 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>';
    4869
    4970wp_die( $die, __( 'WordPress &rsaquo; Error' ) );
  • trunk/src/wp-includes/class-wp-block-parser.php

    r44281 r44359  
    6464
    6565    function __construct( $name, $attrs, $innerBlocks, $innerHTML, $innerContent ) {
    66         $this->blockName    = $name;
    67         $this->attrs        = $attrs;
    68         $this->innerBlocks  = $innerBlocks;
    69         $this->innerHTML    = $innerHTML;
     66        $this->blockName   = $name;
     67        $this->attrs       = $attrs;
     68        $this->innerBlocks = $innerBlocks;
     69        $this->innerHTML   = $innerHTML;
    7070        $this->innerContent = $innerContent;
    7171    }
     
    270270                if ( 0 === $stack_depth ) {
    271271                    if ( isset( $leading_html_start ) ) {
    272                         $this->output[] = (array) self::freeform(
    273                             substr(
    274                                 $this->document,
    275                                 $leading_html_start,
    276                                 $start_offset - $leading_html_start
    277                             )
    278                         );
     272                        $this->output[] = (array) self::freeform( substr(
     273                            $this->document,
     274                            $leading_html_start,
     275                            $start_offset - $leading_html_start
     276                        ) );
    279277                    }
    280278
    281279                    $this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() );
    282                     $this->offset   = $start_offset + $token_length;
     280                    $this->offset = $start_offset + $token_length;
    283281                    return true;
    284282                }
     
    295293            case 'block-opener':
    296294                // track all newly-opened blocks on the stack
    297                 array_push(
    298                     $this->stack,
    299                     new WP_Block_Parser_Frame(
    300                         new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ),
    301                         $start_offset,
    302                         $token_length,
    303                         $start_offset + $token_length,
    304                         $leading_html_start
    305                     )
    306                 );
     295                array_push( $this->stack, new WP_Block_Parser_Frame(
     296                    new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ),
     297                    $start_offset,
     298                    $token_length,
     299                    $start_offset + $token_length,
     300                    $leading_html_start
     301                ) );
    307302                $this->offset = $start_offset + $token_length;
    308303                return true;
     
    335330                 * block and add it as a new innerBlock to the parent
    336331                 */
    337                 $stack_top                        = array_pop( $this->stack );
    338                 $html                             = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset );
    339                 $stack_top->block->innerHTML     .= $html;
     332                $stack_top = array_pop( $this->stack );
     333                $html = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset );
     334                $stack_top->block->innerHTML .= $html;
    340335                $stack_top->block->innerContent[] = $html;
    341                 $stack_top->prev_offset           = $start_offset + $token_length;
     336                $stack_top->prev_offset = $start_offset + $token_length;
    342337
    343338                $this->add_inner_block(
     
    397392        }
    398393
    399         list( $match, $started_at ) = $matches[0];
     394        list( $match, $started_at ) = $matches[ 0 ];
    400395
    401396        $length    = strlen( $match );
    402         $is_closer = isset( $matches['closer'] ) && -1 !== $matches['closer'][1];
    403         $is_void   = isset( $matches['void'] ) && -1 !== $matches['void'][1];
    404         $namespace = $matches['namespace'];
    405         $namespace = ( isset( $namespace ) && -1 !== $namespace[1] ) ? $namespace[0] : 'core/';
    406         $name      = $namespace . $matches['name'][0];
    407         $has_attrs = isset( $matches['attrs'] ) && -1 !== $matches['attrs'][1];
     397        $is_closer = isset( $matches[ 'closer' ] ) && -1 !== $matches[ 'closer' ][ 1 ];
     398        $is_void   = isset( $matches[ 'void' ] ) && -1 !== $matches[ 'void' ][ 1 ];
     399        $namespace = $matches[ 'namespace' ];
     400        $namespace = ( isset( $namespace ) && -1 !== $namespace[ 1 ] ) ? $namespace[ 0 ] : 'core/';
     401        $name      = $namespace . $matches[ 'name' ][ 0 ];
     402        $has_attrs = isset( $matches[ 'attrs' ] ) && -1 !== $matches[ 'attrs' ][ 1 ];
    408403
    409404        /*
     
    412407         */
    413408        $attrs = $has_attrs
    414             ? json_decode( $matches['attrs'][0], /* as-associative */ true )
     409            ? json_decode( $matches[ 'attrs' ][ 0 ], /* as-associative */ true )
    415410            : $this->empty_attrs;
    416411
     
    477472     */
    478473    function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) {
    479         $parent                       = $this->stack[ count( $this->stack ) - 1 ];
     474        $parent = $this->stack[ count( $this->stack ) - 1 ];
    480475        $parent->block->innerBlocks[] = (array) $block;
    481         $html                         = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset );
     476        $html = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset );
    482477
    483478        if ( ! empty( $html ) ) {
    484             $parent->block->innerHTML     .= $html;
     479            $parent->block->innerHTML .= $html;
    485480            $parent->block->innerContent[] = $html;
    486481        }
    487482
    488483        $parent->block->innerContent[] = null;
    489         $parent->prev_offset           = $last_offset ? $last_offset : $token_start + $token_length;
     484        $parent->prev_offset = $last_offset ? $last_offset : $token_start + $token_length;
    490485    }
    491486
     
    506501
    507502        if ( ! empty( $html ) ) {
    508             $stack_top->block->innerHTML     .= $html;
     503            $stack_top->block->innerHTML .= $html;
    509504            $stack_top->block->innerContent[] = $html;
    510505        }
    511506
    512507        if ( isset( $stack_top->leading_html_start ) ) {
    513             $this->output[] = (array) self::freeform(
    514                 substr(
    515                     $this->document,
    516                     $stack_top->leading_html_start,
    517                     $stack_top->token_start - $stack_top->leading_html_start
    518                 )
    519             );
     508            $this->output[] = (array) self::freeform( substr(
     509                $this->document,
     510                $stack_top->leading_html_start,
     511                $stack_top->token_start - $stack_top->leading_html_start
     512            ) );
    520513        }
    521514
  • trunk/src/wp-includes/css

    • Property svn:ignore
      •  

        old new  
        11dist
         2*.min.css
        23
  • trunk/tools/webpack/media.js

    r44115 r44359  
    22
    33var path            = require( 'path' ),
    4     admin_files     = {},
    5     include_files   = {};
    6 
    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 };
     4    admin_files     = {};
    175
    186const baseDir = path.join( __dirname, '../../' );
    197
    20 module.exports = function( env = { environment: 'production', watch: false } ) {
     8module.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    };
    2119
    2220    const mediaConfig = {
  • trunk/tools/webpack/packages.js

    r44283 r44359  
    5050}
    5151
    52 module.exports = function( env = { environment: 'production', watch: false, forceBuildTarget: false } ) {
     52module.exports = function( env = { environment: 'production', watch: false, buildTarget: false } ) {
    5353    const mode = env.environment;
    5454    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';
    5657
    5758    const packages = [
     
    166167        flatten: true,
    167168        transform: ( content ) => {
    168             if ( config.mode === 'production' && ! env.forceBuildTarget ) {
     169            if ( mode === 'production' ) {
    169170                return postcss( [
    170171                    require( 'cssnano' )( {
     
    177178
    178179            return content;
     180        },
     181        transformPath: ( targetPath, sourcePath ) => {
     182            if ( mode === 'production' ) {
     183                return targetPath.replace( /\.css$/, '.min.css' );
     184            }
     185
     186            return targetPath;
    179187        }
    180188    } ) );
     
    269277    }
    270278
    271     if ( env.forceBuildTarget ) {
     279    if ( mode === 'development' && env.buildTarget === 'build/' ) {
    272280        delete config.devtool;
    273281        config.mode = 'production';
  • trunk/webpack.config.js

    r44245 r44359  
    22const packagesConfig = require( './tools/webpack/packages' );
    33
    4 module.exports = function( env = { environment: "production", watch: false, forceBuildTarget: false } ) {
     4module.exports = function( env = { environment: "production", watch: false, buildTarget: false } ) {
    55    if ( ! env.watch ) {
    66        env.watch = false;
    77    }
    88
    9     if ( ! env.forceBuildTarget ) {
    10         env.forceBuildTarget = false;
     9    if ( ! env.buildTarget ) {
     10        env.buildTarget = ( env.mode === 'production' ? 'build/' : 'src/' );
    1111    }
    1212
Note: See TracChangeset for help on using the changeset viewer.