2

Hello I am using Express with Handlebars as view engine and would like to know how to embed images in my templates and make them "visible" to Webpacks' url-loader.

Maybe one possible solution would be to use handlebars-loader but I would prefer not to use it.

What I would like to achieve is to use the Handlebars' equivalent of Jades'

img(src=require("./my/image.png"))

but without the use of handlebars-loader. Thanks

crash
  • 4,152
  • 6
  • 33
  • 54
  • I have similar question but I would like simply to use file-loader on images so they would get transfered from src files to the deployment folder. I had no luck with `handlebars-loader` which ignored images but it turned out `handlebars-templates-loader` (another handlebars loader package) did the trick, so my guess is it depends on the template loader. Still I wish I knew if there was a different way regardless of the template package. – konrad Oct 26 '16 at 20:11
  • Just found out this issue in `handlebars-loader`: https://github.com/pcardune/handlebars-loader/issues/37. Seems like in general either the loader takes care of it in its own way or you might be lucky that chaining the template loader with something like html-loader is possible: one parses the images the other does the templating, but as the linked issue thread demonstrates chaining loaders is not so straightforward. – konrad Oct 26 '16 at 20:21

0 Answers0