Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Youssef
    @youssef06
    Hello guys,
    Is it possible to do i18n with nunjucks?
    Thanks
    Rodrigo Ludgero
    @rludgero
    Hi
    it's possible make something like that, with nunjucks
    <div class="docs-example">
        {% block code_example %}
    
        {% endblock code_example %}
    </div>
    and overwrite the block
    like that
    {% include ‘partials/docs/code-example.html' %}
    
    {% block code_example %}
        <ul class="rl-12 rl-grid-4 rl-small-grid-6 rl-x-small-grid-12">
            <li class="rl-gutter">
                <label for="">Label text</label>
                <input type="text" placeholder="Text" />
            </li>
            <li class="rl-gutter">
                <label for="">Label text</label>
                <input type="url" disabled="disabled" placeholder="Disabled" />
            </li>
            <li class="rl-gutter">
                <label for="">Label text</label>
                <input type="text" readonly="readonly" placeholder="Readonly" />
            </li>
        </ul>
    {% endblock code_example %}
    Rodrigo Ludgero
    @rludgero
    or nested extends?
    Jeremy Mack
    @jeremytmack
    can someone help me with this?
    {% include "../../components/hero-banner-1/_hero-banner-1.html" %} nunjucks doesnt seem to like that relative path?
    rotexhawk
    @rotexhawk
    Hello. Is it possible to add a block to a macro and change that specific block when you import it to a different template ?
    Mindsycle
    @Mindsycle
    Hi all! Have a happy 2017!
    Jay Pozo
    @jaypozo
    Hello, any suggestion on how to pass a nunjucks object to javascript in a template?
    Trung Hieu Nguyen
    @hieunguyen135
    hi
    Erwann Mest
    @kud
    Is it still alive? :D
    poke @jlongster
    David Boles
    @david476
    Hello, I'd like to render synchronously but I'd like access to (or just to throw) the 'possible error's that are passed to the callback. Ideas?
    Dario Abdulrehman
    @dabd
    Hi, we would like to spike parsing Nunjucks templates with the goal of possibly translating them to another templating language. I could not find any EBNF grammar for the full language. What is the best source to find a spec of the full syntax of Nunjucks? Thanks.
    Dario Abdulrehman
    @dabd
    ^I would like to *
    Dario Abdulrehman
    @dabd
    Hi, I am impressed with the effect that enabling caching with noCache = false has on the performance of Nunjucks. It achieves very good performance compared to disabling caching.
    Dario Abdulrehman
    @dabd
    According to the docs it is meant to be a client-side optimisation but we are using it for server-side rendering via Rhino on a JVM.
    I wonder if it will be even faster by using Nashorn or delegating the rendering to a NodeJS small service (outside the JVM).
    Ino
    @Inoshy

    hello, i am facing a problem adding custom filters. I have configured nunjucks as below :
    index.js --

    const express = require('express');
    const nunjucks = require('nunjucks');
    
    const port = 3000;
    const app = express();
    
    nunjucks.configure('views', {
      autoescape: true,
      express: app
    })
    
    app.set('view engine', 'html');
    
    const env = new nunjucks.Environment();
    
    env.addFilter('is_undefined', function(obj) {
      return typeof obj === 'undefined';
    });

    for rendering templates, I am using:

    res.render('register.html', {errors: errors});

    in my template:

    {% if errors|is_undefined %}
      // do something
    {% endif %}

    This is the error I am getting: filter not found: is_undefined

    I searched for threads on ss.o regarding this issue, some answers indicated I need to use env.render()
    instead of res.render(). But as I do that my page doesn't load anymore. Can someone help me??