Build tools: We’ve enabled running WordPress from /src again

In May 2018 we’ve introduced a build step to WordPress coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. development as preparation to WordPress 5.0. While these changes never ended up in 5.0, the idea was to reorganize the way the JavaScript in WordPress is managed and structured so that it would be easier to include GutenbergGutenberg The Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/.

Since then, it was no longer possible to run WordPress from the src folder. This gave some issues, especially with developing WordPress core PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20. Today, @atimmer committed a patchpatch A special text file that describes changes to code, by identifying the files and lines which are added, removed, and altered. It may also be referred to as a diff. A patch can be applied to a codebase for testing. which allows developers to build into src again.

Developers can now run grunt build --dev to build the JavaScriptJavaScript JavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/. and CSSCSS Cascading Style Sheets. into src and use grunt watch --dev to automatically rebuild JavaScript and CSS files when their source is changed.

Advantages

The biggest advantage of running WordPress from src is that changes in the PHP are immediately reflected on the server again, without an extra build step. If you are only making PHP changes, then you can now build the JSJS JavaScript, a web scripting language typically executed in the browser. Often used for advanced user interfaces and behaviors. and CSS once using grunt build --dev and continue coding PHP like you were used to.

Backwards compatibility

This change is fully backwards compatible with the previous setup. grunt build without the --dev flag still works exactly the same. No setups based on it should break.

Up next: Use Webpack to build all JavaScript and CSS

There’s an effort going on to move all JavaScript and CSS build logic into the Webpack configuration. Work done on this so far promises to reduce build times significantly. Especially rebuilds triggered by grunt watch should become much faster. Relevant ticketticket Created for both bug reports and feature development on the bug tracker.: Use Webpack + NPM scripts to build all the things.

#build-tools, #grunt