pattern-lab / patternlab-node

The Node version of Pattern Lab
http://patternlab.io
MIT License
2.05k stars 407 forks source link

Documentation: Custom pattern states and CSS customization #1346

Open renestalder opened 3 years ago

renestalder commented 3 years ago

The documentation for pattern states says, it is possible to add the custom styles for newly added states to ./source/css/pattern-scaffolding.css.

But is this actually true? Is the pattern-scaffolding.css able to overwrite styles in the Pattern Lab UIKit? I believe this is a mistake as to my knowledge, the pattern-scaffolding.css is only loaded via the _head file inside the iFrame of the rendered patterns and doesn't have access to the outside context.

Or I simply misunderstand the documentation.

mfranzke commented 3 years ago

You‘re right, ./source/css/pattern-scaffolding.css is loaded into the iframe and thatfor you‘re able to control the states (which are displayed as dots in there as well), but not within the left or top Patternlab menubar of the navigation. I think we would need a similar possibility to easily tweak styles for that section / the UIKit as well. I think to remember some initiative on that, will have a look and come back to this.

renestalder commented 3 years ago

Alright. Thanks for the confirmation.

mfranzke commented 3 years ago

I sadly haven't found anything during a quick research – so we should probably suggest a mechanism of how to add stylesheets (or probably HTML tags to the <head> in general, maybe this is another good use case) to the outer frame.

mfranzke commented 2 years ago

@renestalder I've release a fork of the https://www.npmjs.com/package/plugin-node-uiextension plugin: https://www.npmjs.com/package/@mfranzke/plugin-node-uiextension

This brings pattern lab 5 support and enables you as well to provide a stylesheet URL that would get embedded to the Pattern lab UI. That should solve your problem, by being able to add those individual stylesheets to that general UI now.