Reputation: 30886
_partial/_mixins.sass
page/generic.sass
@import "_partial/mixins"
page/specific.sass
@import "_partial/mixins"
I'm using SASS with Compass and I have a slight architecture problem right now as I put all my mixins into one file. Now each page have two linked SASS files (one generic) and (one specific to the page).
Both of these SASS files have an @import "_partials/mixins
" which contains a collection of mixins. The problem is as you would expect I'm getting the entire mixins duplicated in both CSS files when I really only want to import that file only so I can use one or two mixins in it (just like I would expect when I import a library in any programming languages, compilation only uses what it needs from the library"
Is there a way when I perform the import on a file to specific exactly what gets loaded perhaps providing a mixin name?
Upvotes: 0
Views: 393
Reputation: 40433
In general, I think it is a bad idea to call mixins in partials you use in more than one place for the reasons you are having. It is much better to define the mixins in those partials, and call them only where you need them.
=my-mixin
font-size: 2em
@import "_partial/mixins"
@import "_partial/mixins"
+mymixin
Upvotes: 1