How to deal with JsRender error exceptions during server-side compiling or rendering?
See original GitHub issueHi, I have the following structure (forget the twig extension, its left from my nunjucks tests):
var appData ={};
res.render('layout', appData, function(err, html) {
res.send(html);
});
test
{{include tmpl='./_includes/footer.html'}}
//if i remove the import, the template get rendered and shows 'test'
I get no errors , just a white page.
How to apply this on the server :
$.views.settings.debugMode(true);
Is this correct :
jsrender.views.settings.debugMode(true)
Whats missing please?
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Specifying onError fallback behavior on a tag - JsRender
The onError fallback string will be rendered whenever there an error (or exception) is encountered during the tag rendering. Setting to the empty...
Read more >Is there a way to fix this Server Side Rendering Error
I just want to use Server Side Rendering to Render a Component In my project. *ERROR in ./server.js Module build failed (from ....
Read more >Server side rendering JavaScript from PHP \ Seb De Deyne
Let's review some server side rendering concepts, benefits and tradeoffs, and build a server renderer in PHP from first principles.
Read more >Handling runtime errors when server side rendering with Next.js
Let's take a look of ways how can we avoid a webpage from crashing in production?
Read more >Client Side Templating with JsRender - DotNetCurry.com
Developers familiar with server side technologies like WebForms on ASP ... In the next section, we see how to render the above with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
“./…” paths are relative paths - they are relative to the calling script - in your case app.js. They are nothing to do with Express.
You need to write
{{include tmpl='./templates/test.html' /}}
OTOH if you use Hapi or Express, you can define the templates directory location, and then write
res.render('_includes/footer', ...
where you are using an Express API - hence the path is relative to the templates folder you set up for Express, and you are omitting the .html extension, since you set that up too for express.JsRender ‘./…’ paths work equally well whether you use Express, Hapi, or neither.
All that is shown in the samples here https://github.com/BorisMoore/jsrender-node-starter, and the docs here http://www.jsviews.com/#node/filetmpls.
Did you start from those samples? If so you should have been starting from the correct
./...
relative paths…Sure!