-
Notifications
You must be signed in to change notification settings - Fork 3
Feedback: Sass exports #20
Comments
So, what’s the benefit for the developer then? @import 'foundation/components/buttons'; and @include foundation-button; seems to be equal in this case. Can you please mention some real example of namespaced component? I’m trying not to use mixin unless I need parameters. Until then I use @extend to avoid duplicating code. But maybe it’s just my ignorance of some pattern. |
@OndrejVasicek This pattern creates a more clear distinction between importing the code of a component (the variables, mixins, and functions that make it work), and exporting the CSS of a component. The The benefit is that importing a component for its mixins only is much easier. In Foundation 5, you need to un-import components you don't want at all. But if you want a component just for its mixins, you need to keep the import, but then dig into the settings file and find the variable to disable that specific component (e.g., For developers who don't care about all the semantic hooks, nothing really changes, because like you said, an Here's an example of namespacing (this isn't possible with #foundation {
@include foundation-everything;
} |
@gakimball aaah... I think I see the light now. So the main benefit is, you don't get the css messy, if you only need to use some of the mixins from the component (or you don't have to turn them off). #foundation {
@include foundation-button;
}
#foundation-brother {
@include foundation-button;
} by this one @include foundation-button;
#foundtaion{
@extend .button;
}
#foundtaion-brother{
@extend .button;
} Which I of course could, and would get less css in result (profit), but then I realized, that @include foundation-button; exports more than that one “.button” class. So the result – my mistake – even the namespacing is useful here, thanks to the new clearer way you guys handle with components and mixinx. For me – thumbs up for sass exports. |
I definitely think this new setup is a better way of dealing with Sass in Foundation. Nice work. |
I'd generally only include the components I'd need, and turn off CSS rendering for everything that didn't deal with the element level (typo, forms, etc), so this definitely makes life easier! If you wanted to make it a bit more explicit it'd be nice if the includes had a prefix like export or render, e.g.
|
Thanks for all the feedback, everyone! The team has went over all these discussion topics and have either incorporated the feedback, have a plan to incorporate I or decided to not include it. We'll close these topics, but feel free to keep adding and discussing if you'd like. |
For Foundation 6, we're changing how CSS is exported to hopefully be simpler to understand.
Simply importing the framework doesn't output CSS. This makes it easy to
@import
the entire framework and not worry about which pieces you want right away.Compile times may be a concern, but the increasing robustness of libsass makes the compile times negligible.
CSS exports are handled through mixins. So a stock
app.scss
might look like this:This also allows components to be namespaced.
The text was updated successfully, but these errors were encountered: