mozbrick / brick

UI Web Components for Modern Web Apps
http://mozbrick.github.io/
Other
2.97k stars 205 forks source link

Allow a `--theme` option to build project with a different theme #231

Open potch opened 10 years ago

potch commented 10 years ago

This should pull a different set of theme files from the theme directory of each component, and build a custom HTML Import for the project.

potch commented 10 years ago

We should also allow theme = none!

sole commented 10 years ago

I wonder if it's possible to just somehow add some CSS that "overrides" some of the rules, but I have the feeling that it's going to be close to impossible due to the way html imports / scoped stuff works.

Picture this situation: I'm a normal average developer who just checked Brick and is mostly happy with how the thing looks like, but would want to change a few things here and there (simple example: the templates).

Maybe I didn't understand it correctly, but in the current scenario I would need to check out the entire bunch of individual element repositories and add a new theme folder to each one, write the .styl file and rebuild using such theme. It seems like a big hassle.

fwenzel commented 10 years ago

Can't you do that anyway, import Brick and then go wild on your own app's styles in a separate CSS file?

sole commented 10 years ago

No, because the styles are scoped and won't be overwritten. It looks like it works right now using the platform.js polyfill in Firefox OS/Firefox, but if you try the template in Chrome which does support actual Shadow DOM, the styles are not overwritten. Nothing changes.

fwenzel commented 10 years ago

Good point! So do we need theme inheritance? Urgh

dotch commented 10 years ago

the ::shadow pseudo element and the /deep/ combinator allow you to style the shadow elements from the outside. however, we need to test if this works consistently with and without polyfill...

sole commented 10 years ago

I wrote a test to determine what is the support for the :root pseudo element/selectors with platform.js and various runtimes: http://sole.github.io/test_cases/web_components/shadow_dom_and_selectors/

The answer, in short, is: