alexcoplan/sculpt

data attributes are super awkward

Closed this issue · 3 comments

Sculpt.render_doc do
  div "data-blah".to_sym => 'blah'    
end

this will prevent adoption, imo.

That is a really good point.. you can currently get around it by quoting the attributes like so:

Sculpt.render_doc do
    div "my div content", "data-foo"=>'x', "data-bar"=>'y'
end

But obviously the sym syntax for hashes is much nicer.

Might have to add an option to Sculpt which is true by default to replace underscores with dashes in syms when they are actually outputted.

dur.. i didn't consider omitting the to_sym part and just using the old-style hash. :/ i'm stupid, sorry.

..using the old-style hash does feel a bit 1.8.7 though..

Have now added the option Sculpt.smart_attrs. It basically replaces underscores in sym keys with dashes. See the the changelog for more info.