ember-component-css icon indicating copy to clipboard operation
ember-component-css copied to clipboard

Allow importing of styles and SASS maps from an addon into an app

Open RobbieTheWagner opened this issue 8 years ago • 18 comments

Currently, I keep my styles in the app directory, so that I can allow the consumers of my addon to import them and override the styles with a SASS map. I would love support for this with this addon!

I talked to @webark about it in another issue, and agreed to open this enhancement request.

RobbieTheWagner avatar Oct 27 '16 19:10 RobbieTheWagner

@webark I wanted to give this a bump. I don't know anything about broccoli or how to learn about broccoli, but I would assume this would just be a switch between using exclusively the addon tree, and using the app tree instead, if app/styles folders exist, rather than looking for addon.scss. If someone could help me on the right path to figuring this out, I am happy to play with it, I just need some direction 😄

RobbieTheWagner avatar May 01 '17 01:05 RobbieTheWagner

@rwwagner90 i'll try to look into this, and garner enough information to layout a plan soon.

webark avatar May 01 '17 04:05 webark

@webark thanks! Given any sort of direction on where to start digging or what to do, I am happy to put in work playing with it, I just don't know how to begin figuring out what to do here.

RobbieTheWagner avatar May 01 '17 13:05 RobbieTheWagner

@rwwagner90 you may find this useful http://www.oligriffiths.com/2017/01/26/Eat-your-greens-A-beginners-guide-to-Broccoli-js/ 🤓

oligriffiths avatar May 01 '17 14:05 oligriffiths

Thanks @oligriffiths I'll start there 😄

RobbieTheWagner avatar May 01 '17 15:05 RobbieTheWagner

Just wanted to chime in and say that I would also like to have this support. @rwwagner90, have you been able to make any progress on it?

mriska avatar Jun 20 '17 08:06 mriska

@rwwagner90 Did you ever figure out a solution for this?

dpatz avatar Aug 15 '18 06:08 dpatz

No, I did not dig into it. It would be great to have still though!

RobbieTheWagner avatar Aug 15 '18 14:08 RobbieTheWagner

the rewrite that is under way could allow for this facilitation more.

A example of what you are looking for would also be helpful in fully understanding the desired functionality.

webark avatar Aug 15 '18 14:08 webark

@webark the desired functionality is to use a sass map to override variables like we do in https://github.com/shipshapecode/ember-3d-nav#styles

Everything from the addon tree gets compiled to CSS and dropped in vendor, so we can't let the user @import the styles or override variables via a sass map currently. Ideally we can still have addon/components/my-component/styles.scss for styles for that component, but do not compile to CSS and merge into vendor.css, rather let the consuming app import the styles and override variables via a sass map.

RobbieTheWagner avatar Aug 15 '18 20:08 RobbieTheWagner

hmm.. never used sass maps before. I'll look this over this weekend and get back to you.

webark avatar Aug 15 '18 22:08 webark

@webark I'm open to other ways of passing and overriding variables, but the main idea is allow the consuming app to override variables, so they can change things like base theme colors from the addon, while keeping core styles in tact, and not needing to write a bunch of manual CSS overrides.

RobbieTheWagner avatar Aug 16 '18 01:08 RobbieTheWagner

@rwwagner90 have you found a way to override the variables in the consuming app?

mbernwieser avatar Jul 03 '19 07:07 mbernwieser

we’ve been doing our theming with css vars and just been letting ie11 rely on what you can polyfill (which is a good portion).. 😬 so we haven’t had a need for this, so i haven’t looked into it much :/

webark avatar Jul 03 '19 08:07 webark

Thanks for the feedback. I'll see if we can go with the css variables too

mbernwieser avatar Jul 03 '19 08:07 mbernwieser

css variables are pretty great. The scoping is really nice also.

webark avatar Jul 03 '19 14:07 webark

I personally just like the syntax of scss instead of css variables, but I suppose css variables is the better, cross platform solution for the long run.

RobbieTheWagner avatar Jul 04 '19 13:07 RobbieTheWagner

the ability to set a variable in the dom elements “style” attribute and have that get applied in that scope is a deal maker for me.

You just can’t do that with a preprocessor.

webark avatar Jul 04 '19 15:07 webark