mozilla / nunjucks

A powerful templating engine with inheritance, asynchronous control, and more (jinja2 inspired)
https://mozilla.github.io/nunjucks/
BSD 2-Clause "Simplified" License
8.57k stars 640 forks source link

nunjucks-slim not sending http request, throws template not found #1154

Open Honatas opened 6 years ago

Honatas commented 6 years ago

Nunjucks works fine on client-side without precompilation. But as soon as I add .pipe(nunjucks.precompile()) to my gulpfile, and include nunjucks-slim.js on my page (no other changes have been made on the code, just these two), I can't see the request to retrieve the template from the server on my network tab (firefox developer) , and the console shows "Error: template not found: ".

I tried using the normal nunjucks.js (not the slim) with the precompiled template, it returns the javascript function as text. The precompiled template was retrieved, so I believe this is not an issue with gulp or the gulp-nunjucks plugin, or anything related to file path.

fdintino commented 6 years ago

nunjucks-slim doesn't download templates. You'll need to include the precompiled template as a <script> tag to use them.