Centralize and Automate Plugin Asset Minification in Webpack#1718
Centralize and Automate Plugin Asset Minification in Webpack#1718ShyamGadde wants to merge 11 commits intoWordPress:trunkfrom
Conversation
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
Added `noErrorOnMissing` to prevent errors when JavaScript or CSS files are absent for specific plugins.
…plugin-asset-minification
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
westonruter
left a comment
There was a problem hiding this comment.
Looking good to me, but someone who is more experienced with webpack than me should review this.
Co-authored-by: Weston Ruter <westonruter@google.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
| - 'tests/multisite.xml' | ||
| - 'composer.json' | ||
| - 'composer.lock' | ||
| - 'webpack.config.js' |
There was a problem hiding this comment.
The reason for adding this is that unit tests for the plugins can fail if the minified assets aren’t generated. Since Webpack is responsible for generating these assets and copying necessary libraries from node_modules to the build, it makes sense to include changes to webpack.config.js as a trigger for the unit tests.
Summary
Fixes #1711
This is also an attempt to improve the solution introduced in #1643 by further streamlining the process of generating minified asset files.
Relevant technical choices
npm run build:plugin:optimization-detective(or any specific plugin), only assets for that plugin are minified.npm run build-pluginsscript, which would otherwise re-minify the same assets multiple times (while the overhead may be minimal, this approach avoids redundancy.)npm run buildis executed, it generates minified versions of assets across all plugins.