Closed jenstornell closed 3 years ago
Hmm, I'm not sure why this would be happening.
Can you try doing {{@includeFile("mypartial.html")/}}
?
I'm guessing Electron uses a different root folder.
I had the same issue with nodejs, In my case the confusion happened because this doc page never mentions we are supposed to define partials in advance during Squirrelly setup:
let Sqrl = require("squirrelly");
app.set('view engine', 'squirrelly')
app.set('views', './views')
Sqrl.templates.define("footer", Sqrl.compile("This is my footer"));
The above is explained in the last page of the documentation.
@nebrelbug Question: How can I define a Partial from an existing template file without having to open the file template file to read and pass all the content as a string value?
Thank you.
Hi @VictorAyalaMX, great question (and sorry for the poor documentation).
Actually, you should be able to use {{@ includeFile('../footer.html', {data: ...}) /}}
. Note that for this to work you'll have to pass the views
option in the configuration of the template file you're rendering (if you're using Express this works automatically)
Embarrassingly, it looks like I didn't actually document that at all :grimacing:
Anyway, hope that helps :smile:.
I have placed the file
mypartial.html
in the root of Electron which runs with node.