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: "...
I'm quite new to nunjucks and from what I have read this is not possible, but I was wondering if anyone had come up with a way of doing this.  I am basically looking to perform a for loop in a nunjucks template based on a value rather than an obj...
I have folder structure as follows:  /app    |-routes.js /public     |-index.html server.js   Server.js looks like this:  var nunjucks = require('nunjucks'); var express        = require('express'); var app            = express(); nun...
How can I set a variable from a Nunjucks extension? For example, here is a template and an extension. The x variable should only be visible from within the sample block.  Template:  {% sample %} {{ x }} {% endsample %}   Extension:  function SampleEx...
So I've found this in the Nunjucks docs:   Function Calls  If you have passed a javascript method to your template, you can call it like normal.  {{ foo(1, 2, 3) }}   But I can't seem to make in work, I've tried putting my function on the...
I have a .njk file that I would like to populate with data from a JSON file.  Currently I am using Webpack.  Here is my JSON File:  {     "ranking": "Colors",     "description": "Here is a ranking of my favorite colors"...
I'm trying to do a case insensitive match inside of an {% if %} statement  The following two approaches do not work:  {% set role = 'APP' %}  {% if 'app' == role %}  1 {% endif %} {% if 'app' in role  %} 2 {% endif %}   Nu...
Moving from Gulp to Webpack (it's a Backbone.js app). I need to precompile all the *.html files (nunjucks templates) & concat into a single js file (e.g. template.min.js).  How can I do that using webpack.config.js?  Project structure:    js/...
I am trying to iterate through a Map object in HTML using for loop.  {%for s in objects%}    <a>{{s}}</a> {%endfor%}   The object is a Map (i.e. {a: b, c: d, e: f}) When I run this code, {{s}} will give me the value of the the object (i.e...
I want to have a 'glass' template literal inside my 'building' template literal.  <script id="building" type="text/x-nunjucks-template">   {% for x in range(0, 5) %}   <a-entity template="src: building.tem...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.