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

Styles that are wrapped with editor styles wrapper are not cached #18741

Closed
jorgefilipecosta opened this issue Nov 26, 2019 · 2 comments
Closed
Assignees
Labels
[Feature] Custom Editor Styles Functionality for adding custom editor styles [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@jorgefilipecosta
Copy link
Member

The mechanism we have to wrap styles with editor styles wrapper is to pass a string with the content of the stylesheet via editor settings and then Gutenberg changes this string before adding it to the dom as a style element.
This solution has a problem, the styles are not cached by the browser, the string with the styles is passed every time the editor loads.
These styles include styles implemented by the theme and can have a considerable size.
I think we should enqueue these styles normally so they are cached by the browser. On settings, we should pass identifiers of the stylesheets that should be rewritten (e.g: the path) on Gutenberg we should dynamically change the stylesheets to wrap them.

@jorgefilipecosta jorgefilipecosta added [Type] Enhancement A suggestion for improvement. [Feature] Custom Editor Styles Functionality for adding custom editor styles [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. labels Nov 26, 2019
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 26, 2019
@oandregal
Copy link
Member

oandregal commented Apr 30, 2020

I was thinking about this and found this issue and the corresponding PR #18763

It looks like this is a dead-end because we can't rely on finding the stylesheet due to some hosts dequeuing the defaults and then concatenating different stylesheets together to serve them through CDNs. Is that correct? If we can't rely on the existence of stylesheets, is there any other alternative to pass it through the editor settings? I can't think of any, so perhaps we can close this?

@jorgefilipecosta
Copy link
Member Author

Yes, let's close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Custom Editor Styles Functionality for adding custom editor styles [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants