If you are concerned about the 1.8
syntax (those ugly hashrockets
), you could do something like this:
%button.navbar-toggle.collapsed{ type: :button, data: { toggle: :collapse, target: "#bs-example-navbar-collapse-1" } }
That's at least a bit better, right? Or you could even try this which also looks better than the old hash syntax:
%button.navbar-toggle.collapsed(type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1")
But that's not what you asked. Yeah, it's possible. Have you tried? I'm not entirely sure why you would want to do this, but this should be possible:
- options_hash = { type: :button, data: { toggle: :collapse, target: "#bs-example-navbar-collapse-1" } }
%button.navbar-toggle.collapsed{ options_hash }