Lack of interpolation of mixin name, variable name...Current sass limit

407 views
Skip to first unread message

Sébastien Lucas

unread,
Dec 6, 2011, 9:19:43 AM12/6/11
to Sass
I've been wanted several time to do this sort of thing

@mixin box($box-style:style-tx1 , $text-style:style-box1) {
@include {$box-style};
}

This is useful, if I have a mixin that wrap box propeties as the
following

@mixin style-tx1($border:false, $color:fase){

}

and you could use it by typing
@include box($box-style:style-tx1);
to apply style-tx1 mixin to the current element in a consitent way

The workaround I've found was to use short css properties to pass
style properties and to minimize the number of argument

But sometimes for text for example the declaration don't take all text
properties and I need to pass 2 or three argument

I want to have a sort of indesign style like where I can define in one
place text style, box style, paragrapher style...

Till now as I understood interpolation of variable name, mixin name,
extend class name don't work

$style = border-style
${$style}
don't work

$my-mixin = style-tx1
@include {$my-mixin}
don't work,

$my-class = .content
@extend {$my-class}
don't work,

I don't know if it's by design and would be always like this or if
there is a possibility to implement this feature in the future

As a reference the sass css framework that I'm trying to build to
design drupal theme.
https://github.com/sinsunsan/ia_mix

I'm using as base two sass framework twitter bootstrap and compass. Do
you know other intiative of this type ?

Chris Eppstein

unread,
Jul 2, 2012, 6:06:56 PM7/2/12
to sass...@googlegroups.com
We've expressly rejected these features. In almost all cases I've seen presented, having a map/hash data structure in sass would be sufficient to meet the use case requirements without needing "meta programming". A map data structure is planned for the release following 3.2.

chris

On Mon, Jul 2, 2012 at 10:41 AM, Anthony Topper <tto...@gmail.com> wrote:
I've wanted the same thing myself.  Haven't been able to figure out a way to do it.
--
You received this message because you are subscribed to the Google Groups "Sass" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sass-lang/-/B3FJJGwI0P0J.

To post to this group, send email to sass...@googlegroups.com.
To unsubscribe from this group, send email to sass-lang+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sass-lang?hl=en.

Capi Etheriel

unread,
Jul 11, 2012, 7:57:52 AM7/11/12
to sass...@googlegroups.com
map structures <3
chris

To unsubscribe from this group, send email to sass-lang+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages