shama / yo-yoify

Transform choo, yo-yo or bel template strings into pure and fast document calls
111 stars 17 forks source link

Breaks on attributes with strings and template expressions #1

Closed shama closed 8 years ago

shama commented 8 years ago

This example will cause it to break:

var className = 'test'
var element = yo`<div class="${className} broken">dang</div>`

This is because the transform is only expecting attributes to either be a string or template expression but not both.

The work around for now is:

var className = 'test'
var element = yo`<div class="${className + ' broken'}">dang</div>`
shama commented 8 years ago

That only fixed pieces that come after but doesn't fix pieces that come before:

var element = yo`<a href="/${slug}">click</a>`