Skip to content

WIP: locally scope CSS to '.gutenberg' class#77

Open
billiegoose wants to merge 4 commits intomatejlatin:masterfrom
wmhilton-contrib:feature/local-scope
Open

WIP: locally scope CSS to '.gutenberg' class#77
billiegoose wants to merge 4 commits intomatejlatin:masterfrom
wmhilton-contrib:feature/local-scope

Conversation

@billiegoose
Copy link

An effort to address #63

This is still a WORK IN PROGRESS but I thought I'd share where I'm at in case a) I never finish or b) somebody has a suggestion.

Right now, everything is locally scoped except some stray 'html' and 'body' references. I'm comparing the output with the example and eyeballing it to make sure it matches. Right now, I can detect one flaw, and that's the h1 font-size is off (45px instead of 40px).

One potential issue is the 'rem' usage. Since rem depends on the font-size on the html element, and since setting the font-size on the html element affects the entire page, it could conflict with the CSS of existing sites. So I've added an option to disable the 'rem' output and only use the pixels.

I'd like to go further, and empower users of CSS-in-JS frameworks to apply the styles from individual modules (say, _quote.scss) to their own components, rather than hard coding the CSS to the <blockquote> element. However, I'm not sure what the best way to do that is yet.

I'm building a WYSIWYG editor using Slate by the way. I wanted it to look nice, which is how I stumbled across Gutenberg.

@billiegoose
Copy link
Author

@matejlatin I discovered a race condition in the JavaScript code. If the images haven't fully loaded before the resize code runs, it can end up setting their height to 0 which is not good, because then the image isn't visible.

@matejlatin Would you prefer one big PR or 3-4 small PRs? I can separate my changes into bug-fixes vs enhancements if that would make your job easier reviewing them.

@matejlatin
Copy link
Owner

I can separate my changes into bug-fixes vs enhancements if that would make your job easier reviewing them.

@wmhilton that would be really helpful thanks. In terms of sizes of PRs, I don't have a preference. Whatever is easier for you.

@matejlatin
Copy link
Owner

@wmhilton let me know when you're done and I'll review the PR in detail.

@billiegoose
Copy link
Author

I'll never get around to finishing this PR... the project I was using Gutenberg for at work switched to a different style and Gutenberg wasn't being used anymore so I had to work on other things. Sorry. :-(

@SwagDevOps
Copy link

Use sass :

.gutenberg {
  @import "~gutenberg-web-type/src/style/gutenberg";
}

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