Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logic for block style entry points #390

Merged

Conversation

dmtrmrv
Copy link
Contributor

@dmtrmrv dmtrmrv commented Apr 22, 2024

Related Issue/RFC: #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: 10up/wp-scaffold#229

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • 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

Copy link

changeset-bot bot commented Apr 22, 2024

🦋 Changeset detected

Latest commit: 2c116e6

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 dmtrmrv marked this pull request as ready for review May 21, 2024 00:27
@nicholasio
Copy link
Member

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

@fabiankaegy fabiankaegy merged commit cb646bb into develop Sep 24, 2024
7 checks passed
@fabiankaegy fabiankaegy deleted the feature/339-filename-based-entrypoint-for-block-specific-CSS branch September 24, 2024 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants