Gutenberg icon indicating copy to clipboard operation
Gutenberg copied to clipboard

Gutenberg doesn't play nice with other styles/libs

Open stefanchrobot opened this issue 8 years ago • 8 comments

It's tough to use Gutenberg together with other styles/libs, since it's hijacking top-level and generic selectors, i.e. *, html and body.

What do you think about scoping Gutenberg's application to a certain subtree, i.e.:

...
<body>
  <div class="some-stuff">
  </div>
  <div class="gutenberg">
    <!-- Gutenberg's rules apply here -->
  </div>
</body>
...

stefanchrobot avatar Dec 12 '16 23:12 stefanchrobot

Hey @stefanchrobot I think that's a good idea. This issue has never crossed my mind tbh. I'll keep it in mind for the next release...

matejlatin avatar Feb 24 '17 20:02 matejlatin

I wonder if it is possible to create a marriage between Bulma and Gutenberg. Bulma does not affect the generic selectors and has a special class "content" for an area where a CMS or whatever inserts html-formatted content with generic selectors only.

juh2 avatar Jun 17 '18 14:06 juh2

@juh2 I haven't heard of Bulma... what is it?

matejlatin avatar Jun 18 '18 16:06 matejlatin

I really like Gutenberg's look, but am struggling to figure out how I could sneak it into an existing project without it breaking everything is styled globally without a "gutenberg" class.

billiegoose avatar Aug 20 '18 19:08 billiegoose

@wmhilton I know what you mean, others mentioned this and I experience it myself. Unfortunately, I don't have much time to work on this. Do you have any ideas how this could be done better?

matejlatin avatar Aug 23 '18 08:08 matejlatin

Well, I started by just prepending a .gutenberg class selector to all the styles in src/style/gutenberg.css. Then I deleted the styles applied directly to the top-level body and html.

There's probably a way to do it cleverly using SASS... hold on while I try something... if it works I'll make a PR.

billiegoose avatar Aug 23 '18 14:08 billiegoose

Awesome, that would be much appreciated @wmhilton !

matejlatin avatar Aug 23 '18 14:08 matejlatin

Use sass :

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

SwagDevOps avatar May 04 '19 16:05 SwagDevOps