jaekwon / CoffeeMugg

HTML templates in pure CoffeeScript
MIT License
19 stars 3 forks source link

Support svg #1

Open wmertens opened 12 years ago

wmertens commented 12 years ago

There's <svg> support in coffeekup (see https://github.com/gradus/coffeecup/commit/07ffa72d92e5d0832566bd0e1e23f82479f8395c), but since CoffeeMugg uses this you could even do one better and switch out this so that under @svg only SVG elements are allowed...

jaekwon commented 12 years ago

Nice. Curious what you're using SVG for?

wmertens commented 12 years ago

I'm using svg with d3.js which is seriously awesome (check out the examples), which maps an array of data to DOM elements (normally SVG elements but it could be anything) and updates them when the data changes.

My pipe dream is that CoffeeMugg could be used to do the same. At the very least it could be used to create templates that are then assigned using d3 (so it needs SVG support), but I think that using instantiation and some automatic id creation CoffeeMugg could even do the mapping of any data to DOM itself, and then d3 would provide the graphing algorithms. I'm still thinking about it, but it would be something that you run once to generate the html and then again to update elements. You would even be able to generate the html server side and perform the updates in the browser. Once I've got it hammered out I'll create an issue :-).