Echo JS 0.11.0

<~>
m3g4p0p 2423 days ago. link 1 point
This is just a small utility function I found useful in some projects of mine... so I thought maybe you'll find it useful too. :-)

Replies

pselviakcay 2423 days ago. link 3 points
Great idea! 2 suggestions:

1) implement it as a tag for template literals so you can do fromHtml`#something`

2) create a webpack plugin so the templates can be precompiled
m3g4p0p 2421 days ago. link 1 point
Hey there, many thx for your feedback!

1) That seemed like an obvious approach at first... but then again there's nothing particular about the interpolation process, so you'd actually just end up reimplementing the default behaviour. Also, it would be more awkward to pass in (or not to pass in) an options object... I'll have a look at allowing both though!

2) That sounds like a nice idea! But wouldn't the regular html-loader to the trick as well?

const fromHTML = require('from-html')
const template = require('./template.html')
const { something } = fromHTML(template)