less.ruby icon indicating copy to clipboard operation
less.ruby copied to clipboard

Dynamic Mixins Not Nesting Properly

Open daz4126 opened this issue 15 years ago • 4 comments

.foo(@bar:1){
  div{color:red;}}

#test{.foo(2);}

Produces (note the rogue 'foo' that has been added to the nested property!):

#test {
  foo div { color: red; }

}

daz4126 avatar Oct 13 '09 06:10 daz4126

This is on v1.2.11 btw

daz4126 avatar Oct 13 '09 06:10 daz4126

It looks like the mixin name is always getting added for nested children. Here's some test markup:

.box-shadow-mixin (@h: 0, @v: 0, @blur: 0, @color: none) {
          box-shadow: @h @v @blur @color;
     -moz-box-shadow: @h @v @blur @color;
  -webkit-box-shadow: @h @v @blur @color;
  h1 {
    background-color: @color;
  }
}

.random-box {
  .box-shadow-mixin(0, 2px, 10px, black);
}

tcjr avatar Nov 12 '09 18:11 tcjr

I had to reimplement dynamic mixins in a more robust way, to isolate them from external scope (circa 1.2.11), the problem with that is nesting won't work, so for now it'll throw a compile error, until I figure out a good way to implement this (and have the time to do so), which plays nicely with nesting.

cloudhead avatar Nov 21 '09 04:11 cloudhead

Good to know. I noticed recent activity and it's nice to see that this is part of what's being worked on! Thanks, dude.

xdissent avatar Nov 24 '09 03:11 xdissent