flatiron / plates

Light-weight, logic-less, DSL-free, templates for all javascript environments!
MIT License
831 stars 69 forks source link

support css selectors #61

Open max-mapper opened 12 years ago

max-mapper commented 12 years ago

instead of this:

var html = '<span class="name">User</span>...<span class="name">User</span>'
var data = { "username": "John Smith" }
var map = Plates.Map()
map.class('name').to('username')
console.log(Plates.bind(html, data, map))

i want to do this:

var html = '<span class="name">User</span>...<span id="name">User</span>'
var data = { ".username": "John Smith", "#username": "Bob Hope" }
console.log(Plates.bind(html, data, map))
dscape commented 12 years ago

I didn't write plates but from conversations I had with Paolo about it I think this is a bad idea.

Plates is super fast and simple. It does so by parsing very little and being very picky in the battles it fights.

For some degree of CSS selectors (like the ones your shown) it might be possible to do, but some other would imply a full parser which is not what plates does (or used to do when I last looked at it)

dscape commented 12 years ago

Still love you max dickbag

jfhbrook commented 11 years ago

One nice thing is that cheerio already does the hard part of implementing css selectors. :)

pksunkara commented 11 years ago

Yeah, cheerio does but it also does things which are not required for plates.

I support @dscape on this.

trusktr commented 11 years ago

CSS selectors would really be nice. Plates is already really nice, as far at HTML templating.