Closed alejo-monkee closed 2 years ago
It looks like you reder to a partial called "header" that can't be found. Do you have such a partial?
Note that this extension will only look for partials in the "./partials" subfolder.
@johnknoop Hey, thanks for answering!
Yes, it is there (Sorry, before I posted the wrong link: https://github.com/jkasun/sa-handle-bars)
Currenty, the extension only looks for a "partials" folder directly under the root folder, so in this case you need to open the "views" folder in VS code.
Thanks for the hint, @johnknoop. Sadly, that doesn't work either. When I try to preview view/home.hbs
, I get the same error:
Error rendering handlebars template: {"message":"The partial header could not be found","name":"Error"}
But it should work, right? Does it work for you?
I believe I lied to you by mistake. The extension doesn't treat the partials
folder any differently than other folders. Therefor, you need to prefix the name of the partial, like this:
I know that this differs from how for example express-handlebars works, where the "partials" folder is magic in the sense that any templates in that folder are registered as the filename only.
Does the workaround work for you? Otherwise, I could try and ship an update within a week or so that registers all templates under /partials directly.
It would work to preview but sadly would also break my code. Not really convenient for me because I have 35+ templates to edit, each on its own folder.
An update will be utmost appreciated.
I'll try to find some time for this. In the meantime, you should be able to work around it by changing the partialsDir folder in your express code from views/partials
to just views
. I haven't tried this myself, but it should work from what I understand when reading their docs.
@alejo-monkee Sorry for the long wait. It completely escaped me, but I've now added a reminder for myself to address this.
Did you manage to work around it or are you still waiting for this?
@alejo-monkee Fixed and published!
All templates located in a folder called either "Partials" or "partials" directly under the workspace root will now be registered under the filename directly.
Hi. I was learning handlerbars then I tried your plugin.
First, I cloned this simple hbs example ( git@github.com:jkasun/sa-handle-bars.git ). It runs as expected in http://localhost:3000/ with
$ node app.js
.But then, when I want to preview a .hbs file with your plugin, I always get
Error rendering handlebars template : {"message":"The partial header could not be found","name":"Error"}
Where is the problem? Thanks in advance!