Would including an "officially recommended" file extension in Nunjucks' documentation go against the philosophy of Nunjucks? Even though the compiler is agnostic, it seems like the community is interested in one. There are a number of unofficial extensions floating around: .nunjucks
, .nunjs
, .nunj
,.njk
., .njs
, ...
I think this is worth discussion because (1) in absence of official direction, the community has come up with its own file extensions, and (2) Jinja2's recommendation to hijack another file extension, in my opinion, seems to contradict the purpose of file extensions. An ideal outcome from this discussion might be updating the Nunjucks documentation with a recommendation, to inspire some uniformity in the community and among all the tutorials and recipes for implementing Nunjucks.
I understand Nunjucks is based heavily on Jinja2, and that Jinja2 recommends:
A Jinja template is simply a text file. Jinja can generate any text-based format (HTML, XML, CSV, LaTeX, etc.). A Jinja template doesn’t need to have a specific extension: .html, .xml, or any other extension is just fine.
But even if it doesn't need a specific extension, it would be be helpful to guide the folks that want to give it one. I agree with Carl Meyer's response to a related question I (wrongly) posted on Github:
Personally I use the.j2
extension for both Jinja2 and Nunjucks templates (in some cases I will render the same template with either renderer, so I prefer having a single extension for both). I don't agree with the recommendation in the Jinja2 docs -- an HTML file is not the same thing as a Jinja2 template of an HTML file; I'll often "stack" extensions and use e.g..html.j2
for an HTML Jinja2 template.
That's all just my personal preference, though -- I'm not really aware of any community standard here.
I'm grabbing the list of .nunjucks
, .nunjs
, .nunj
,.njk
., and .njs
from Nunjucks syntax plugins for Atom, Brackets, Sublime, and Vim. I'm not sure what the relative prevalence is among these extensions. Maybe worth noting that .nj doesn't seem to contradict an existing extension either, if brevity is a chief concern.
Any thoughts?
--
You received this message because you are subscribed to the Google Groups "Nunjucks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nunjucks+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Nunjucks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nunjucks+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "Nunjucks" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nunjucks/mJbJ96OPUGQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nunjucks+u...@googlegroups.com.