Questions tagged [gulp-nunjucks-render]

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.

32 questions
0
votes
0 answers

Precompile/compile nunjucks refresh issue gulp-inline-source

Hi there this is a long shot but, hope someone can help, I am using gulp-inline-source-html (https://github.com/exuanbo/gulp-inline-source-html) & gulp-nunjucks-render (https://github.com/carlitoplatanito/gulp-nunjucks-render) plus browserSync to…
roshambo
  • 2,624
  • 6
  • 31
  • 54
0
votes
0 answers

How can I render a template inside asyncEach in nunjucks

{% asyncEach example in component.examples %} {% include "./example.njk" %} {% endeach %} // example.njk
0
votes
1 answer

How to properly return an associative array back to a nunjucks template

Within my gulp nunjucks area, I created a custom filter that generates date & time information for the week. I'm stuck in knowing how to return an associative array back into my nunjucks template and how to reference any of the array values. Below…
klewis
  • 7,459
  • 15
  • 58
  • 102
0
votes
1 answer

Gulp Loop Renders locale tag Incorrectly in Nunjucks Template

I've created a gulp task to generate four pages based on the same template, for different languages / locales. The locales are: en-US, en-CA, en-NZ and en-AU. Previously, it was just a simple task written four times - once for each locale, with…
cslem
  • 51
  • 9
0
votes
1 answer

How to render a global variable as data inside for loop in the nunjucks?

I faced with a problem: I have global variables with SVG icons and I want to render all icons inside template using for loop. How to render a global variable as data inside for loop. facebook:
Av0me
  • 3
  • 3
0
votes
1 answer

Gulp 4 - How to generate dynamic tasks based on two arrays

I'm building an e-mail generation pipeline (multiple templates) using nunjucks and json translation files. This means I need to loop over the multiple templates and the translation files, however I can't seem to get it working. Tried adding another…
elDrimm
  • 106
  • 1
  • 9
0
votes
1 answer

How to setup the baseurl for nunjucks

I want to deploy the site to different servers for testing, production etc. So defining a basepath by changing one variable or setting would be the prefered method. What is the best method to implement this? Currently I have set a variable in layout…
Lasithds
  • 2,161
  • 25
  • 39
0
votes
3 answers

How can i multiply data in nunjuncks?

for instance
{{blocks.quantity}} x {{blocks.price}}
i want to multiply price by quantity data from Json file.
Bravis
  • 91
  • 1
  • 9
0
votes
1 answer

How to set macro variable in the page template for Nunjucks

I am using Nunjucks to set up a complicated site. My folder structure is as such: frontend/ |- dev/ |- gulpfile.js |- css/ |- images/ |- js/ |- pages/ |- dashboard.njk |- templates/ |- macros/ |-…
Cienwen
  • 107
  • 3
  • 10
0
votes
1 answer

gulp-nunjucks-render is taking a lot of time to compile

I am using gulp-nunjucks-render for HTML templating. The problem is, it is taking more than 3-4 minutes to compile. Even though I have only seven nunjucks templates. 'use strict'; var gulp = require('gulp'), autoprefixer =…
Ajay Rawat
  • 307
  • 3
  • 10
0
votes
0 answers

Add key-value pair in exiting json object in nunjucks

I want to add a new key-value pair in JSON object with nunjucks template, but unable to add it(don't want to add any custom filter). suppose I have an object var obj = {"id": "1", "name": "test", "child": {"id": "2", "status": "true"}, …
0
votes
1 answer

Delete a json key-vaue in nunjucks variable

I am stuck at a point where I want to delete a key-value pair from json object in nunjucks template variable. I have an object: var json = {"id": "123", "obj": {"id": "456", "name": "testing"}, "name":"test", "template": "{% set object = json.obj…
0
votes
1 answer

gulp-nunjucks-render and adding data from single file

How can I include data to gulp-nunjucks template from separate file? //template/data/data.html {% set list = [ { title: 'Item1' }, { title: 'Item2' } ] %} This simple solution doesn't work. {% include…
Skif
  • 1,178
  • 4
  • 14
  • 26
0
votes
1 answer

Can Nunjucks output files in multiple languages

I'm trying to create a multi language page, I was hoping to use different json files for different languages and have gulp output the files with a language suffix in the file name. So far I've loaded a data file, and cannot output a single object…
0
votes
2 answers

Render value to tenths place in nunjucks template?

Using the round() filter I can achieve the correct precision to the tenths place as in {{ value | round(1) }} however I still want to display the tenths place if value is zero or a whole integer. (0.0 instead of 0, 3.0 instead of 3) Is there a…
Don
  • 3,876
  • 10
  • 47
  • 76