New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Splat operator (conditional attributes) support? #29
Comments
Yeah, skim should support all the same language constructs as slim, including the splat operator. |
I'm not sure what you mean by "should support". Do you mean it currently does, or that you're working on it? |
Sorry, that was ambiguous. I mean, the design goal of skim is to support the same syntax as slim (modulo CoffeScript for Ruby). So the current lack of splat operator support is a bug. |
Does this mean there's no way to do dynamic attributes with Skim at present? I'm trying to generate a tag where the "data-*" attributes vary. Not sure if there's some other way to do it? |
EDIT: Discovered the Splat operator, re-writing...
I'm trying to set up a conditional attribute... for example, I want the result to be one of the two following:
or
The condition would be whether or not the href exists. So the skim pseudo-code would be something like this:
I know that doesn't work, obviously, but I can't find any way to do this in skim. Slim supports it via their splat operator. The "correct" coffeescript version would be like the example just above. In ruby/slim it's
a *( @url ? { href: @url } : {} )
I'd rather not do this:
Because "Lotsa content" is a ton of code duplication. I also don't want the
href
in thea
tag, because clicking on an empty href causes the page to reload. I could make the link do nothing when clicked on if there's no href, but it would be much easier just to omit the href and let that behavior happen naturally.Would it be possible to implement the splat operator?
The text was updated successfully, but these errors were encountered: