Skip to content
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

Option for Nunjucks Engine Support #156

Open
iamchathu opened this issue Mar 1, 2017 · 16 comments
Open

Option for Nunjucks Engine Support #156

iamchathu opened this issue Mar 1, 2017 · 16 comments

Comments

@iamchathu
Copy link

Add support for Nunjucks engine as an option.

@gokaygurcan
Copy link

This was requested before in #87 and I remember I did that in #119

This was the last comment from @dougwilson about the PR:

Thanks again for the PR, though! It is perfectly fine, the only real reason I'm even closing it is that it seems like the used module is really weird as-is and the maintainers don't even want to bother with the Express/js integration.

And I believe he's right about this.

There's this package though: https://github.com/pkolt/express-nunjucks maybe that'll be more useful. If you think that this is a good addition/feature, than I can pick it this evening.

@iamchathu
Copy link
Author

I went though the links and saw that Nunjucks maintainers need to remove support to express! I liked Nunjucks syntax since it heavily burrowed features from swig which is not now not maintained. But Nunjucks have syntax highlighter plugins for major IDEs and text editors.

I think using express-nunjucks rather than Nunjucks seems good for future.

@Gchesta
Copy link

Gchesta commented May 10, 2017

Nunjucks is a stable Templating engine supported by mozilla and Extremely robust. It's also ideal for people coming from Django and Flask (Python). I don't undertand why people should need to install another package (Express Nunjucks) just to handle this template.

@dougwilson
Copy link
Contributor

Hi @Gchesta you should let Mozilla know you want them to support Express. You can let them know here: mozilla/nunjucks#611 . Mozilla is the ones who think you should install another package to handle their template language (see their own issue mozilla/nunjucks#611).

@ashwin31
Copy link

Hi @dougwilson I am from django background, I like express and nunjucks, can you see if some one can fix these https://github.com/mozilla/nunjucks/labels/express they don't see anyone fixing issues related to express and that could be the cause for raising mozilla/nunjucks#611

@dougwilson
Copy link
Contributor

Hi @ashwin31 thanks for that information! I don't know anyone who I can nominate to fix the issues, but if you happen to know anyone, definitely send them on over there :) !

@coderam
Copy link

coderam commented Nov 20, 2017

hi, @gokaygurcan -- would you be able to add the nunjucks support for the generator? it has been requested much because so many people have been moving over from django and django uses essentially nunjucks templating.

@ghost
Copy link

ghost commented Nov 20, 2017

I just forked this at https://github.com/windysurf/generator and made changes to express-cli.js still needs to be finalized. can anyone lend a hand?

@ghost
Copy link

ghost commented Nov 20, 2017

update to my fork, i attempted a local install of my forked ./generator folder, then ran an express --view=nunjucks generator-test --- sorry to say eveything was good but did not copy my index.html, layout.html and error.html to the views folder. I am new to node from Django so could use a hand here. @dougwilson (maybe you can checkout my code and see if something funny stands out. and of course, @gokaygurcan if you still have the desire to help, i have everything mostly complete, but could use a hand.

@gokaygurcan
Copy link

Hi @Windysurf,
I cloned your repo (windysurf/generator) and ran it:

node .\bin\express-cli.js --view=nunjucks nunjucks-test

   create : nunjucks-test
   create : nunjucks-test/package.json
   create : nunjucks-test/app.js
   create : nunjucks-test/routes
   create : nunjucks-test/routes/index.js
   create : nunjucks-test/routes/users.js
   create : nunjucks-test/public
   create : nunjucks-test/views
   create : nunjucks-test/views/index.html
   create : nunjucks-test/views/layout.html
   create : nunjucks-test/views/error.html
   create : nunjucks-test/bin
   create : nunjucks-test/bin/www
   create : nunjucks-test/public/images
   create : nunjucks-test/public/javascripts
   create : nunjucks-test/public/stylesheets
   create : nunjucks-test/public/stylesheets/style.css

   install dependencies:
     > cd nunjucks-test && npm install

   run the app:
     > SET DEBUG=nunjucks-test:* & npm start

It seems index.html, layout.html and error.html are copied from templates/nunjucks folder to views folder. They are exactly the same.

In the meantime, I needed to fix a typo in bin/express-cli.js line 54.
I'm not sure what the problem is, but I can help you if you need.

@ghost
Copy link

ghost commented Nov 22, 2017

Fixed line 54, thanks for that @gokaygurcan . I created a test-project folder then npm install . in that folder, then attempted to run "node app.js" on the generated folder, but nothing runs and the terminal does not spit out any output. Any ideas?

@ghost
Copy link

ghost commented Nov 24, 2017

hi @gokaygurcan, i pushed to my forked repo the typo, but beyond that my programming abilities waver. Do you think you could take the "front-end" of what I changed and finalize it making sure that the templates render? It would be a major goodness as Django uses the same templating so people can start coming over in your merit!

@ghost
Copy link

ghost commented Nov 24, 2017

@dougwilson (and hopefully @gokaygurcan), if you checkout my fork for generator, the front-end of this is mostly done, just need a little help from an experienced Noder to wrap it up. the --nunjucks option works and the files are generated... needs a bit of testing.

@dougwilson
Copy link
Contributor

Sorry I have been away an unable to take a look myself yet. You're always welcome to make a pull request even if you are not done (you can state that in your PR). It makes it quick and easy to see the changes and CI status. I can even hell directly by pushing to the PR too, no worries. I can help with anything related tl the generator, but know nothing about nunchucks.

@ghost
Copy link

ghost commented Dec 1, 2017

@dougwilson thanks, a schizophrenic first attempt :)

@ghost
Copy link

ghost commented Dec 1, 2017

@gokaygurcan @dougwilson created pull request with nunjucks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants