grunt-dss icon indicating copy to clipboard operation
grunt-dss copied to clipboard

How to add state (class and pseudo-class) to markup.example ?

Open ethyde opened this issue 11 years ago • 1 comments

I think with custom parser for markup and template ? But after some research and testing I have not found a good solution ...

Thanks for any help :)

edit and it's probably a side effect of https://github.com/darcyclarke/grunt-dss/issues/15 ?

ethyde avatar Apr 21 '14 09:04 ethyde

I did it with a small template change and some jquery. Not perfect, but easy and better than nothing:

{{#state}}
<div class="example state">
  <div class="name">{{name}}</div>
  <div class="item" data-state="{{escaped}}">
    {{{../markup.example}}}
  </div>
</div>
{{/state}}




$(function() {
  $("div.example.state > div.item").each(function() {
    var pseudoState = $(this).attr("data-state");
    $(this).children().addClass(pseudoState);
  })
});

dwarcher avatar Sep 24 '14 17:09 dwarcher