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

CSS Only Entrypoints #356

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

CSS Only Entrypoints #356

wants to merge 2 commits into from

Conversation

nicholasio
Copy link
Member

@nicholasio nicholasio commented Jan 8, 2024

Related Issue/RFC: #168

Description of the Change

Alternate Designs

Possible Drawbacks

Verification Process

  1. npm run dev
  2. Add the Example block (WITHOUT LINARIA)
  3. Change both style.css and editor.css.
  4. Changes should hot-reload

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 Jan 8, 2024

⚠️ No Changeset found

Latest commit: 0598487

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

true
);

$settings['editor_script_handles'][] = $script_handle;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabiankaegy What would be the best way to register the style handler for the frontend AND gutenberg?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as editorScript there also is a script property in block.json that loads in both places


$js_editor_hmr_file = $dir . '/' . str_replace( '.css', '.js', $editor_style_file_name );

// TODO: do not enqueue this file if its name ends up being the same as editorScript
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure there might be some other edge cases, we need a way to safely load these things automatically, perhaps we add a flag per block?

@fabiankaegy
Copy link
Member

@nicholasio I just tested this and it works like a charm 🤩

@fabiankaegy
Copy link
Member

@nicholasio what are the next steps here? how can I help move this forward?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants