-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get string instead of function? #171
Comments
In WebPack you can use raw-loader to load content of file "raw-loader!./my-template.hbs" |
I wish it were that simple! That was my first of many attempts. Doing so just returns the handlebars function in a string. Looking through this loader's code and comparing it to other loaders, there's no path that outputs just a pure string it looks :( |
Sorry for resurrecting a dead issue, but did anyone ever figure out a way of doing this? I am trying to use Handlebars to render a template inside Vue, but it keeps just printing the function reference. |
Yeah, I know how it would usually work. I tried to solve this by using skeleton-loader and eval'ing the content given to it, to return just the resulting html, but that just spits out errors about modules not being found, etc. I guess I'll just go with pug-plain-loader instead, and get back to trying to solve it with handlebars another day. |
Apologies if the solution is obvious, but is there any way to import Handlebars templates as strings and not functions? I'd like to skip the cost of evaluating the function in my client-side code and also skip the ~60k increase in bundle size from bundling the Handlebars runtime. It seems it should be pretty straightforward, but no matter what options or loader combination I try I haven't been successful.
For example, if I put
Hello World
intomy-template.hbs
I'd like the following TypeScript code:to produce the following JS code:
The text was updated successfully, but these errors were encountered: