handlebars-loader icon indicating copy to clipboard operation
handlebars-loader copied to clipboard

Simulate loader behavior in Node.js environment

Open just-boris opened this issue 9 years ago • 0 comments

Thanks for you awesome loader! I am using this and really like how it loads helpers and partials. Unfortunately, it is not supported in raw Handlebars, but I'd like to run my templates with Node as well.

Node.js module system also allows writing custom loaders to require.extensions object. I wrote this one and I'd like to share it with you:

https://gist.github.com/just-boris/ea02ff33b09d6ce3b492

This code makes Handlebars in Node.js behave as well in your loader and allows to use relative paths to helpers and partials. I guess some people here might find this useful for them as well as me.

just-boris avatar Jan 21 '16 10:01 just-boris