10up-toolkit icon indicating copy to clipboard operation
10up-toolkit copied to clipboard

Add logic for block style entry points

Open dmtrmrv opened this issue 1 year ago • 2 comments

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

  1. 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.
  2. Webpack Entry Updates (entry.js):

    • Introduced a new configuration option loadBlockSpecificStyles to 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/blocks directory.
    • Merged the new entry points for block stylesheets with the existing build files.
  3. Default Configuration Update (config.js):

    • Added the loadBlockSpecificStyles option to the default configuration, with a default value set to false.

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

dmtrmrv avatar Apr 22 '24 19:04 dmtrmrv

🦋 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

changeset-bot[bot] avatar Apr 22 '24 19:04 changeset-bot[bot]

@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.

nicholasio avatar May 22 '24 12:05 nicholasio