Add logic for block style entry points
Related Issue/RFC: https://github.com/10up/10up-toolkit/issues/339
This PR introduces several enhancements and fixes to the configuration and entry logic for the toolkit package. Key changes include the reorganization of path configurations, the addition of a new configuration option for loading block-specific styles, and the update of the webpack entry to support this new feature.
Changes
-
Path Configuration Updates (
paths.config.js):- Reorganized and added a new path configuration for
blocksStyles. - Maintained the order of properties for better readability and consistency.
- Reorganized and added a new path configuration for
-
Webpack Entry Updates (
entry.js):- Introduced a new configuration option
loadBlockSpecificStylesto conditionally load CSS files specific to blocks. - Implemented logic to automatically discover and create entry points for block-specific stylesheets located in the
assets/css/blocksdirectory. - Merged the new entry points for block stylesheets with the existing build files.
- Introduced a new configuration option
-
Default Configuration Update (
config.js):- Added the
loadBlockSpecificStylesoption to the default configuration, with a default value set tofalse.
- Added the
Requires this to be deployed to Scaffold: https://github.com/10up/wp-scaffold/pull/229
Checklist:
- [x] I have read the CONTRIBUTING document.
- [x] My code follows the code style of this project.
- [x] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my change.
- [ ] All new and existing tests passed.
- [ ] I have added a changeset to my PR. See CONTRIBUTING document for instructions
🦋 Changeset detected
Latest commit: 2c116e6f949674f5a451ad7be668341a148017b4
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| 10up-toolkit | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@dmtrmrv Would you mind try adding a few e2e tests? You can follow the structure of the existing e2e tests, essentially you can create a new "project" with an expected block structure, run tooklit via jest then asset that toolkit is compiling the right files.