nested quotes in haml
-
26-05-2021 - |
문제
I'm trying to convert my knockoutJs html code to HAML, trying to achieve something after compilation like:
<div data-bind="attr: { 'data-something': someValue }">...</div>
So I try:
%div{data:{bind:"attr: { 'data-something': someValue }"}}
But using haml_assets 0.1.0 I get:
<div data-bind="attr: { "data-something': someValue }'>...</div>
So my last resort was go back to:
== <div data-bind="attr: { 'data-something': someValue }">...</div>
Is this a bug in HAML, and/or is there a neater way to achive this?
해결책
This is an issue on haml_assets 0.1.0. A ticket was created for this: https://github.com/infbio/haml_assets/issues/10
There is also a better workaround for it until it is fixed:
%div{data:{bind:'attr: { "data-something": someValue }'}}
다른 팁
Try this:
%div(data-bind="attr: { 'data-something': someValue }")
When I did this in a RoR app that uses HAML I get this rendered:
<div data-bind="attr: { 'data-something': someValue }"></div>
제휴하지 않습니다 StackOverflow