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
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)