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

Block Editor: automatically generate inline CSS for editor theme supports #187

Closed
nickcernis opened this issue Feb 26, 2019 · 6 comments
Closed
Assignees

Comments

@nickcernis
Copy link
Collaborator

In recent (unreleased) StudioPress theme updates, we've started generating Gutenberg inline CSS code on the front and back that can be inferred automatically from theme supports such as editor-font-sizes and editor-color-palettes.

I'd like to explore doing the same in Genesis Sample to reduce the amount of Gutenberg-related CSS people have to write when using Sample as a starting point for their themes.

@nickcernis nickcernis added this to the Genesis Sample 2.9.0 milestone Feb 26, 2019
@wpfangirl
Copy link

That sounds like a wonderful idea.

@jb510
Copy link

jb510 commented Feb 26, 2019

This sounds scary...

I'm not necessarily opposed to it, but I am concerned with anything generating inline styles that might over-ride existing child theme CSS.

What "inline CSS" specifically is going to get injected based on theme supports? (I obviously haven't seen the unreleased updates)

@nickcernis
Copy link
Collaborator Author

nickcernis commented Feb 26, 2019

@jb510 Nothing scary, just removing the need to add CSS like this manually:

.entry-content p.has-small-font-size {
font-size: 12px;
}
.entry-content p.has-regular-font-size {
font-size: 16px;
}
.entry-content p.has-large-font-size {
font-size: 20px;
}
.entry-content p.has-larger-font-size {
font-size: 24px;
}

As that CSS can already be inferred from:

return array(
array(
'name' => __( 'Small', 'genesis-sample' ),
'size' => 12,
'slug' => 'small',
),
array(
'name' => __( 'Normal', 'genesis-sample' ),
'size' => 16,
'slug' => 'normal',
),
array(
'name' => __( 'Large', 'genesis-sample' ),
'size' => 20,
'slug' => 'large',
),
array(
'name' => __( 'Larger', 'genesis-sample' ),
'size' => 24,
'slug' => 'larger',
),
);

Same with editor-color-palette.

Also, in case you hadn't spotted it, this proposal is for the Genesis Sample repo. You could remove it if you didn't want to use it, and it won't affect Genesis itself/other child themes at present.

@jb510
Copy link

jb510 commented Feb 26, 2019

Ugh, I'll be more careful, that's the second time I mistook an issue for Genesis Sample as an issue for Genesis core... Sorry.

@nickcernis
Copy link
Collaborator Author

@jb510 No problem! Thanks for taking an interest in this stuff and for sharing your thoughts.

@nickcernis
Copy link
Collaborator Author

Work on this has now been merged into develop in #198.

This will form part of the Genesis Sample 2.9.0 release planned for late this week.

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

No branches or pull requests

3 participants