-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Proposal] Switching default template engine #3407
Comments
Personally I'd vote for Jade or Nunjucks. |
The syntax of Jade is too different from the default syntax to be the default choice of Sails in my opinion. Nunjucks seems a great choice. Easy to learn, to read and custom tags seems easy to implement. |
Agreed with regards to Jade, but Jade is the default template engine of Express which is why I recommend it. Nunjucks does have a really nice syntax indeed. |
Agree with this statement, also supporting Jade.
Or at the least Sails should prompt you for a supported templating engine when generating a new app and not provide a default. |
Yes it is, but does that mean that every framework using express need to use Jade? No.
Note: You can specify which templating engine you want |
Sails already supports Jade with asset linking, it should be pretty straightforward to make it the default. Less work at the end of the day. |
It does not mean EVERY framework using express need to use Jade, it is just a strong argument for it. As far as speed is concerned, it is the slowest JS templating, I'll grant you that. But Jade 2.0 will change that.
I think I agree, but sails is also advertising itself as being un-opinionated about these things. Which is why I say it might lose the default and ask. I think at the end of the day it is whatever the Balderdashy team uses in-house will be the default. |
I've been using swig for a couple of weeks now, works great. Not sure how is that different from nunjucks but it also looks great. In my opinion jade's syntax is just too ugly for a framework like sails. |
@Mirago Swig is no longer maintained as far as I know. Nunjucks would be a better options in my opinion. |
For anyone interested, http://adonisjs.com uses Nunjucks - syntax looks great. |
I get the fact that we're talking opinion here, but I can't quite get calling Jade ugly (especially when compared with swig). Jade is one of the few templating language that hardly even requires a style guide. Based on being a tabbed language it is already composed, organized and easy to read. It solves much of the spaghetti mess that HTML creates. As far as Jade is concerned slowness is a valid complaint, dynamic includes is a valid complaint, but ugly is hardly a valid complaint. Combining HTML and Script will hardly be pretty no matter the implementation. |
Wow, AdonisJS seems to be a Laravel port to NodeJs 👮 |
Yup, laravel.js :) |
Hi @randallmeeker, it's completely just my opinion, nothing more. I love swig/nunjucks syntax, therefore I would prefer if one of them was implemented as a default template engine. As I understand you prefer jade, and that is absolutely fine. |
To be honest, I don't think Sails.js is going to get many new features. Work has already begun on Trails which will replace Sails. |
@niallobrien That's why this project seems dead? Why do not continue to work on SailsJS? They can just bump up the major version... |
@niallobrien is this true? Is there any more info about it? |
@niallobrien thanks. This is a huge surprise to me, especially when we are ~3 weeks into development using sails :/ |
@Mirago Yeah, but at least there will be a migration path. Are you guys building a SPA app with REST API or a hybrid of server & client code? |
@Mirago As long as you're using Sails 0.11.x or newer, there will be a migration path. |
Apologies @tjwebb if I've left the cat out of the hat. :) |
@niallobrien haha, no worries. It is open source, after all: https://github.com/trailsjs 😺 . We have no secrets. I don't want to derail this thread too much, though, except to say that the conversations in these Sails issues are things that we think about in our design for trails. |
@tjwebb Agreed. I think most here would agree that although Jade is the default template engine for Express (I personally use it daily and like it), and Sails.js already supports Jade (with linking), Nunjucks simply has a much nicer syntax without forcing beginners to wrestle with a whitespace sensitive templating language. For those reasons I would recommend that Nunjucks should replace EJS as the default templating language for new Sails.js projects. This would also require asset linking functionality out of the box. |
Why not use Handlebars? It has a clean syntax, powerful filters and the partial support it's pretty good. |
Yea, everyone has their pet templating engine that they think is better. That's why the correct approach is to just configure the one you want and not have the framework set one for you. |
+1 nunjucks |
I agree with leaving the default as switching is easy, but I'll also like to vote for nunjucks if a change is going to happen. |
What can we do to make this happen? Just get a PR together or do we need the core team to agree before wasting time? |
We'll be sticking with EJS. |
@mikermcneil Why? Clearly people would like to see Sails move to a templating language that's relevant in today's market, is supported (Bitovi have archived EJS from what I can see) and have it be the default with Sails out of the box. Yes, changing templating languages is easy, but if if the first thing the majority do is change the templating language, then that's surely an indication of friction? |
@niallobrien Sails isn't married to ejs. If you don't like it, use something else? I don't use server-side templating at all, because that's not "relevant to today's market". |
@niallobrien It's not just because I'm a big fuddy duddy and it's what we use in all our projects (but that is also true)-- it's just that I believe it's the most practical approach. This is actually one of the things I covered in one of my very first talks about Sails, and one of the things from that talk that is still most relevant today. The reason why I made this choice early on is that EJS looks like ERB, which looks like PHP, which looks like GSP, which looks like JSP, which looks like ASP. It allowed me to much more quickly onboard developers who were new to Node. We all know there's nothing magical going on with Jade et al -- but it can be a big shock if you're not used to seeing it. With EJS, I could show Sails views to people with little to no technical experience, and they'd be able to edit them to match customer copy or comps using skills they learned from messing with Geocities templates in the early 2000s, or later Wordpress themes. Hope that helps :) Going forward, I'd love it if everyone who is passionate about this issue would help improve the docs to make it more straightforward to switch to other templating languages. |
To bring some closure to the discussion earlier on in this issue, re:
@RomainLanz @niallobrien @Mirago @randallmeeker Statements like these have been causing some major confusion in our community. I've posted more about this in the Status of Sails issue, but heres a quick recap:
If you have questions or concerns about the health of the community, the status of the project, the future of the framework, or any other strategic questions about Sails, our team, or our mission, please don't hesitate to contact me directly. |
Dear everyone,
EJS is pretty old, not really fast and has a rubbish syntax.
Also, Sails depends on ejs-locals that is not maintained anymore.
What do you think of switching to another templating engine by default?
The developper of ejs-locals recommend to use DustJS or ECT.
Node.JS template engines benchmark
As you can see with this (old) benchmark, ECT and DustJS is two time faster than EJS.
It is also an opportunities to develop some great helpers/filters for Sails like the route helper proposed here: [Proposal] Route helper for view
The text was updated successfully, but these errors were encountered: