Does SASS or LESS support variable mixin arguments? [closed]
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
开发者_如何转开发 Improve this questionSomething like (contrived LESS example):
.bg() {
background: (@arguments);
}
#blah{
.background(red, url('blah'))
.background(blue)
}
Cheers
This does work in LESSCSS, but you have 2 errors in your code. First, missing semicolons for statement terminators. Second, you defined a .bg() mixin but tried to reference it as .background(). Try this:
.bg() {
background: (@arguments);
}
#blah{
.bg(red, url('blah'));
.bg(blue);
}
The output is exactly like you would expect:
#blah {
background: red url('blah');
background: blue;
}
You can run code samples to see if and how things like this compile in LESS CSS using my LESS javascript-based converter (files on GitHub), or just follow the LESSCSS client-side usage instructions to see it working on your own pages.
精彩评论