Nunjucks is a rich and powerful templating language for JavaScript. gulp-nunjucks-render is a gulp plugin which renders Nunjucks templates. Use this tag for questions regarding rendering nunjucks templates with gulp, using the gulp-nunjucks-render plugin.
Questions tagged [gulp-nunjucks-render]
32 questions
4
votes
3 answers
Get current URL in Nunjucks template?
Seems like it should be pretty straightforward, but I'm having a really hard time finding an answer.
How do you find the current page's URL within a Nunjucks template?
Something like this would be perfect:
Some link

saricden
- 2,084
- 4
- 29
- 40
4
votes
0 answers
Detect changes between multiple source files using Gulp
The original issue I was having was that the task was running x amount of times for the number of files existing inside src.pages, I fixed this by adding the 'changed-in-place' plugin, to compare the last date modified of the source files. This…

Luke
- 195
- 2
- 16
2
votes
3 answers
Dynamic title and description in the Nunjucks template engine
I'm trying to understand the language of Nunjucks templates.
To generate HTML I use Gulp + plugin gulp-nunjucks-render.
Faced a problem: I can not understand how to implement the generation of meta tags title and description.
Project file…

Yuri Fedorov
- 33
- 1
- 6
1
vote
0 answers
gulp fails to include files on case sensitive file systems
I'm trying to run a project on Ubuntu, which uses Nunjucks, and the gulp-nunjucks-render plugin is used to render the Nunjucks templates.
The developers were mainly using this project on Windows and Mac OS, so there was no issue when including files…

Renaud is Not Bill Gates
- 1,684
- 34
- 105
- 191
1
vote
1 answer
Passing current file name in to the nunjuck template
is there some possibility to pass current folder name in to the nunjuck template?
Something like:
This folder name is {{currentFolderName}}
Output:
This folder name is navigation
from path for exmpl: blahblah/components/navigation
Thanks :)

Michal Šimkovič
- 11
- 1
1
vote
3 answers
How to use nunjucks groupby with different value?
i can`t figure out how can i gropBy my data from Json when i have this kind of values
2017-10-16 12:07:07
2017-10-16 12:07:07
2017-10-16 15:09:08
2017-10-16 15:09:08
2017-10-16 15:09:08
2017-10-16 15:09:08
2017-10-16 15:09:08
2017-10-16…

Gosha Travin
- 25
- 1
- 7
1
vote
1 answer
How to add nunjucks-date-filter?
I can't understand where should i put all this code ,
https://github.com/e-picas/nunjucks-date-filter
i have this structure
enter image description here
this is my template
…

Gosha Travin
- 25
- 1
- 7
1
vote
1 answer
Looping over json, gulp-nunjucks-render rendering all files with same content
I'm trying to render 30+ html pages with gulp-nunjucks-render. I have created one nunjucks template and two json files (general template parts for header and footer and an array of posts data). The logic inside the "posts" function loop is simple: I…

Kaur Saarepuu
- 11
- 3
1
vote
1 answer
Multiple Nunjucks files with different JSON data using gulp
I would like to use gulp and Nunjucks to generate multiple template files at once with varying content. These templates will all have the exact same layout, but pass in different variables for text/images.
I am able to successfully generate a single…

Morgan
- 574
- 9
- 28
1
vote
3 answers
Nunjucks dynamic page template
i'm using nunjucks (gulp) as templating language and i want to build a dynamic page template.
This is my Json:
"pages": [
{
uname: "Welcome",
title: "Page 1 Headline"
},
{
uname: "About",
title: "Page 2…

Ingo Köpp
- 19
- 1
- 3
1
vote
1 answer
Check for NaN in nunjucks template?
I'm trying to display 'n/a' instead of NaN in a popup. Something like:
{% if value == NaN %}
n/a
{% endif %}
I realize I can always catch it earlier on before the template is rendered but Is there was a way to check for NaN values…

Don
- 3,876
- 10
- 47
- 76
1
vote
0 answers
Rendering a template using Gulp, Nunjucks, and an Array
I have some html like this:
u-color-background-gray-100
…
Ole
- 41,793
- 59
- 191
- 359
0
votes
1 answer
How to automate functional programing, and avoid repeating myself
Within my gulpfile.js I have the following two functions that are making use of rendering gulp-nun-jucks for 2 different views...
function genNunJucks(cb) {
return src(paths.views.src)
.pipe(nunjucksRender({
path:…

klewis
- 7,459
- 15
- 58
- 102
0
votes
0 answers
NodeJS Express Nunjucks: Error: template not found: frontend/home.html at createTemplate
Error: template not found: frontend/home.html
at createTemplate (/var/www/apps/moss/crash-game/node_modules/nunjucks/src/environment.js:290:15)
at next (/var/www/apps/moss/crash-game/node_modules/nunjucks/src/lib.js:330:7)
at handle…

asega
- 33
- 8
0
votes
1 answer
How to wrap HTML to If Expression statements in Nunjucks
Based on the following docs, I can easily make use of the If Expressions as exampled.
But how can we take them further by wrapping HTML to the object? I want to do something like this...
{{ "" . foo . " " if foo else '' }}
what would be…

klewis
- 7,459
- 15
- 58
- 102