Escape logic tags in {% raw %}
See original GitHub issueI know that I can use {% raw %}
to escape {{ output tags }}
, but it doesn’t work with {% logic tags %}
. Is there a way that ninjucks
would output {%
? Like:
{% extends "client-base.html" %}
My use case is rather unusual: I want to use nunjucks
to output Django template. I need to use nunjucks
(or any other JS template engine), because I’m using webpack
to build static assets and I want to “insert” dynamic script names into the Django template.
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Liquid template language - Shopify Open Source
An overview of template tags in the Liquid template language. ... Encloses multiple tags within one set of delimiters, to allow writing Liquid...
Read more >Built-in template tags and filters - Django documentation
This document describes Django's built-in template tags and filters. ... This is equivalent to manually applying the escape filter to each variable.
Read more >Raw String Literal in C++ - GeeksforGeeks
Whereas, a raw string literal is a string in which the escape characters like ' \n, \t, or \” ' of C++ are...
Read more >Jinja Documentation (3.0.x) » Template Designer ...
Minus sign at the end of {% raw -%} tag cleans all the spaces and ... or " ) you SHOULD escape it...
Read more >How to escape liquid template tags? - Stack Overflow
it is possible to disable liquid processing engine using the raw tag: {% raw %} {% this %} {% endraw %}. will display...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If, by any chance, somebody stumbles upon similar problem [0], this is my hacky way to “solve” it: https://gist.github.com/iyn/0177e51ae7e005b19e51
I created very simple
webpack
plugin that processeswebpack
stats (object with the info about the build process, generated files etc) sends the array of files to include tonunjucks
template which then generates Django template. I don’t want to write a long essay here, but long story short, I need this to use in production build, becausewebpack
generates dynamic filenames (hash of the content) and I want to include them in the Django template automatically after every build. This is because my production scripts often change and dynamic name makes me sure that every time client sees up-to date version of my app.[0] Too many times I have had this exact experience: https://xkcd.com/979/ 😉
I tried both versions. However I realized that it’s not the problem with
nunjucks
but with thewebpack
plugin I’m using (html-webpack-plugin
),nunjucks
works perfectly fine. I still didn’t solve the problem, but I’m closing this issue, since it’s not related tonunjucks
.Thank you for your time and sorry for not researching the problem enough.