I like this idea. In talking to Tab Atkins about the new CSS improvements
coming down the pipeline, we discussed this. In CSS there will be a document
cascade of mixin values, so this will be possible. In Sass, mixins currently
overwrite the definition in a global map so we would need to instead keep a
list of previous values... not really that hard to do.
also I think you'll need to be able to pass vars to it etc after munging
them. So the syntax we came up with was this:
@mixin foo($arg) {
@mix foo($arg + 1);
}
(They use @mix instead of @include)
Basically a reference to the same mixin within a mixin is an implicit
reference to the previous definition -- not a recursive reference.
Chris
On Wed, Jan 26, 2011 at 8:09 AM, rdougan <[email protected]>wrote:
> I'm working on a large project using Sass/Compass right now which will
> allow user customization and I've noticed that in a few places
> extending mixins would be awesome.
>
> Obviously this is a very simple example and the syntax would need to
> be thought about more:
>
> //defined already
> @mixin create-button($name, $color) {
> button.#{$name} {
> color: darken($color, 50);
> background: $color;
> }
> }
>
> //then the user can overwrite
> @mixin create-button($name, $color, $padding) {
> super;
>
> button.#{$name} {
> padding: $padding;
> }
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Haml" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <haml%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/haml?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.