-
Notifications
You must be signed in to change notification settings - Fork 642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Future plans for nunjucks? #1433
Comments
+1 for this, I'm still using nunjucks quite heavily. Partially out of habit but it also has lots of features I haven't seen elsewhere, using blocks and extend is just amazing! |
+1 as well. The source code should probably be modernized (eg with classes, awaits, Typescript etc) to help it keep up. |
+1 it is the best html templating engine. |
I've been working on nunjucks "v4" off and on for quite some time now. It is structured as a monorepo, with the parser, compiler, and runtime in separate packages. The biggest change is that the compiler generates javascript AST rather than raw strings (though That said, I don't want to over-promise anything. Work and family life take up a lot of my time, and we don't use nunjucks as much at The Atlantic, so I have to work on it on my own time. If anyone is interested in helping to get v4 to a place where it can become a public beta, please reply here or send me an email at [email protected]. |
I really want a modern Promises-oriented version that doesn't use asyncFor etc so I've spent the last couple of weeks implementing one. Its almost done, although there are a few tests still to get working. I've part-way converted the implementation to Typescript as well, mucked around with the code formatting, ripped some stuff out, etc as I felt I needed all the help I could get to get things done. The fork is here https://github.com/benbriedis/nunjucksBB if you want to have a look. It might be possible to merge the two pieces of work together somehow if you think it would be useful. I'm also pressed for time and really have to get a project out the door, but I could probably find a bit bit more time to get things done. |
Meanwhile, there was a new PR just last week. |
Any news? |
no news, do you guys know any better and modern alternative ? |
I can highly recommend Vento! |
thank you for the recommendation. It's really good alternative. |
If you're doing much work in Javascript then you should consider JSX, and in particular TSX (i.e. JSX with Typescript). This means using React, Solid, Preact, or perhaps using something like MorphDOM. TSX is less of a templating language and more, as the name suggests, 'extended' Typescript. This brings some big advantages:
The level of support is a result of the fact it is basically javascript, and any other templating language will have difficulty providing a developer experience that is as good. As Vento is tied to Deno, maybe they have a chance. To date Vue has been the main competitor to React in Javascript land. The main disadvantages of JSX/TSX are that its a bit ugly, it is not a strong sandbox in the same way as a templating language, and there is more to learn. |
@benbriedis for React, Solid, Preact etc - of course that would be JSX not much options left there. I am looking for easy to use not overly complicated backend template engine for NodeJS (Javascript). Just tired of reactivity and excessive unneeded complexity of React like libs. Want to try HTMX, but for that I need a great html generation on the backend |
After trying many template engines I migrated all projects to Vento maybe half a year and never looked back. It’s simple, modern, well maintained and easily extendable with a few lines of JS. Vento can be used in Deno and Node projects. The author describes the advantages and disadvantages of other template engines including Nunjucks. Vento is the result of this investigation. I’m not trying to convince you; but according to what you wrote Vento seems to be a good fit 😉 |
@Brixy ok, definitely will have a look at Vento! If you were to compare Vento vs Twig, how would you describe pros & cons? |
Twig was not on my list. Maybe someone else can compare these two?! I came from Nunjucks and Liquid, then tried the ones listed on Vento website + pug (just a bit), some others I probably forgot about, HTMX and JSX. Also played with WebC which is also very interesting. But I really prefer a language that just extends HTML. Vento’s syntax is great, and you can pipe default JS or your own JS functions like
You can also write your own function within a Vento template
|
I'm yet to try Htmx and Vento, but this gives me some homework to do :-) @bora89 I believe it is possible to use TSX and JSX in a lightweight non-reactive fashion using 'h' - see https://www.typescriptlang.org/tsconfig#jsxFactory A warning though: I'm yet to try this myself. It should allow for an upgrade path in the future though should you need it. @Brixy I used Twig in the past a lot. It has many 'extends' and 'includes' variants which seemed appealing to me at the time, but in practice they were unnecessarily heavyweight. I think you do better in Nunjucks just using 'set' commands and macros and end up with more maintainable code. Also its basically a PHP thing which complicates matters. |
We deal with a lot of user driven input for these templates, so we currently run the templating inside |
This might be "too little, too late" for most, but fwiw I've finally got nunjucks v4 to a state where I felt comfortable making the repository public. There is a tracking ticket where I've listed the work that needs to be done. I welcome any and all assistance with completing the remaining work. |
@fdintino It's never too little... Nunjucks template have its place IMO. Thank you for your time and effort <3 (I mainly use it for email/ticket templating and then basic standalone pages) |
@fdintino sorry if I missed this, but can we get context on why you're moving development to a different org? Is Nunjucks no longer maintained by Mozilla? Are you the only maintainer left working on the project? Again, apologies is this was mentioned elsewhere! Will follow development on v4 in the meantime 👀 |
@robinmetral nunjucks hasn't been maintained by mozilla for quite a long time, since long before even I took over as maintainer. The idea behind the separate organization was that it could house other nunjucks-related projects. And also because there are organization-wide github repository settings that I can't change. If I want to use a github actions workflow that isn't already on the mozilla org allow-list I have to file a bugzilla ticket to get it added. I am the only maintainer left working on nunjucks, and I haven't had much time to spend on it. It is much less critical to our projects at The Atlantic than it once was, so I mostly work on it on my own time. The majority of the v4 code was written two years ago, but I got swept up in other projects and it was left in a private repository in an unfinished state. Still, the fact that it existed made me less inclined to fix bugs in this repository, as they were generally fixed in my rewrite. For the past few months I've made a push to finish the v4 work and get the project to a state where others could contribute. My goal is to eventually hand off maintenance of the project, and so I'll look to see whether there is a demand for the features in v4 and a community that would help maintain it. If there isn't, but people step forward who would help maintain this repository, I would be fine with that as well. Edit: of course, if there was momentum behind the v4 repository, I would remain involved. |
Thanks a million for the context @fdintino 🙌 It helps a lot, and your decisions make a lot of sense. I'll be following development on v4! |
I love using nunjucks, but every other templating engine still receive some attentions.
I would hate to see this project die. Are there any plans to merge some PR at some point?
On the homepage, they still feature "Firefox Marketplace" as "someone who uses nunjucks".
The text was updated successfully, but these errors were encountered: