You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@cloudhead: I've been google searching for days too see if this was possible with LESS. Is there a chance of it in the future? On a complex site I could be looking at all kinds of variables and it'd be great to be able to organize them inside mixins and be able to access them from other sources.
Fixed, thanks for pointing it out. I guess it's not that big of a deal, I can always seperate variables in my stylesheet with comments. But I have a few frameworks I've built and I like to use pieces from each one on occassion. So I prepend each variable with the name of my framework. It'd save a lot of time building these frameworks out if I could do something like this:
Some of my frameworks do as much as the twitter bootstrap, and end up having a LOT of variables. Be a lot easier to write these frameworks if I could just set them inside of a wrapping mixin.
Activity
cloudhead commentedon Apr 9, 2010
I've decided to scrap accessors, at least for the first version. It turns out they aren't all that useful..
alixaxel commentedon Jan 11, 2012
@cloudhead: That's a shame, I could really see potential for "OO" organization in them (Issue #564).
I assume we have to wait at least till version 2 now?
mindfullsilence commentedon Mar 7, 2012
@cloudhead: I've been google searching for days too see if this was possible with LESS. Is there a chance of it in the future? On a complex site I could be looking at all kinds of variables and it'd be great to be able to organize them inside mixins and be able to access them from other sources.
vars.less: .colors() { @blue: #234; @red: #b3452; etc... } .grid() { @col-width: 5em; @col-gutter: 1em; }main.less: @import "vars"; .alert { width: .grid[@col-width] * 12; margin: 0 (.grid[@col-gutter]/2) 0 (.grid[@col-gutter]/2) color: .colors[@red]; background: lighten(.colors[@red], 50%); }This would be INSANELY helpful. Is there hope?
alixaxel commentedon Mar 7, 2012
@mindfullsilence:
@col-gutteror.grid[@col-gutter]? I don't think there's hope for this tho...mindfullsilence commentedon Mar 7, 2012
Fixed, thanks for pointing it out. I guess it's not that big of a deal, I can always seperate variables in my stylesheet with comments. But I have a few frameworks I've built and I like to use pieces from each one on occassion. So I prepend each variable with the name of my framework. It'd save a lot of time building these frameworks out if I could do something like this:
fw-1.less: .fw-1_colors() { @red: #2345ba; @blue: #928342; }fw-2.less: fw-2_colors() { @red: #239401; @blue: #293872; }Without this option, I end up prefixing every variable I have:
@fw-1-colors_red: #2345ba; @fw-2-colors_red: #239401; @fw-1-colors_blue: #928342; @fw-2-colors_blue: #293872;Some of my frameworks do as much as the twitter bootstrap, and end up having a LOT of variables. Be a lot easier to write these frameworks if I could just set them inside of a wrapping mixin.
lukeapage commentedon Mar 8, 2012
have you tried
I'd like to hear from @cloudhead whether this is a feature or a bug though (it could cause collisions if your using functions written by someone else)