0

I have a bookmarklet which creates a UI for the user to interact with. Currently, I have been using $('<element>').addClass().css({..});, but that becomes hard to maintain. Is there a better way to do this?

I have also tried doing something like

var html = "<div class='someclass'>";
html += "<more html/>";
html += "</div>"

Which is also incredibly hard to maintain. Is there a way I can write html within javascript, or a library like jade that i can use WITHIN a javascript bookmarklet?

Stephen K
  • 697
  • 9
  • 26

1 Answers1

1

Yes, there is a Domain Specific Language implementation in JavaScript to allow you to write more expressive HTML in JavaScript called Pithy.

Please remember that writing large amounts in Pithy is maybe not a good idea and you rather want to use a proper client side templating engine such as DustJS or many others.

Bjoern Rennhak
  • 6,766
  • 1
  • 16
  • 21