Use another template engine as default instead of EJS for next Sails versions

1,096 views
Skip to first unread message

Vadorequest

unread,
Sep 29, 2014, 9:54:51 AM9/29/14
to sai...@googlegroups.com
Hello.

I don't know if you noticed but I believe the EJS project is dead or is close too.
For people who wouldn't know, the guy who was developping it stopped a few months ago, someone else took his place but it's going nowhere.

I have followed the eveolution of this template engine for the past few months and I don't have faith in it.

I would like Sails.js dev team to consider another template engine system as default in the next versions, EJS works quite bad and isn't maintained, it would be a wise choice to use something with more functions and possibilities like Mustache.js or better Handlebars.js.

This is an open discussion, I would like to have your feelings about it.
Maybe we also should list all features we want/need into the next template engine, I proposed Mustache and Handlebars because I read they were great, tried to use them with sails.js but couldn't reproduce what EJS did because it was quite liked with my app (deeply).

I think a great framework needs a great template engine and EJS isn't.

Vadorequest

unread,
Sep 29, 2014, 9:57:42 AM9/29/14
to sai...@googlegroups.com
For those who would like some kind of "proof", please read this link: https://github.com/visionmedia/ejs/pull/142#issuecomment-33063995

Alberto Souza

unread,
Sep 29, 2014, 10:01:43 AM9/29/14
to Vadorequest, sai...@googlegroups.com
I vote for handlebars.js 

I think we need to update the sails generator to generate the structure with the new engine.

Sergio Lepore

unread,
Sep 29, 2014, 12:02:29 PM9/29/14
to sai...@googlegroups.com
+1 for Handlebars.js and +1 for Swig.js

:)

Jeff Boothe

unread,
Sep 29, 2014, 12:51:07 PM9/29/14
to sai...@googlegroups.com
+1 handlebars

Dave Sag

unread,
Sep 29, 2014, 4:20:35 PM9/29/14
to sai...@googlegroups.com
I tend to agree - and vote for Jade to be the default template engine.

d
Message has been deleted

Martin

unread,
Sep 29, 2014, 9:05:18 PM9/29/14
to sai...@googlegroups.com
I agree and I vote for jade.

kamiyam

unread,
Sep 30, 2014, 3:37:17 AM9/30/14
to sai...@googlegroups.com
+1 Handlebars

2014年9月29日月曜日 22時54分51秒 UTC+9 Vadorequest:

David Lai

unread,
Sep 30, 2014, 2:14:49 PM9/30/14
to sai...@googlegroups.com
+1 to Handlebars.  Guess I'm a partial Ember guy.  

But I think the syntax is overall very simple and can also be used on the client side as well.  Makes for less context switching for a fullstack developer.




Randall Meeker

unread,
Oct 1, 2014, 12:15:41 PM10/1/14
to sai...@googlegroups.com
jade

Kevin Baker

unread,
Oct 2, 2014, 12:09:28 PM10/2/14
to sai...@googlegroups.com
+1 for handlebars.

Being able to use the same template syntax on front and back, would be amazing!

Vadorequest

unread,
Oct 10, 2014, 5:16:24 AM10/10/14
to sai...@googlegroups.com
It seems that Handlebars is the most wanted. I'm wondering if it wouldn't possible make some hooks to simplify the use of these template engines, I don't know what are the limitations or if it's suitable in this case.

Alberto Souza

unread,
Oct 10, 2014, 5:21:56 AM10/10/14
to Vadorequest, sai...@googlegroups.com
Sails.js alow to set custom template engine in views.ext and views.fn and extension then i think this "defaut" sails template engine is for sails generate app

Ambroise Dhenain

unread,
Oct 10, 2014, 5:30:55 AM10/10/14
to Alberto Souza, sai...@googlegroups.com
I agree, but since it seems that people would like to have some "choice" here, I'm just wondering if having hooks to help a bit would be useful.

But I agree, I was talking about the default template engine in this thread.

Zenobius Jiricek

unread,
Dec 11, 2014, 3:44:31 AM12/11/14
to sai...@googlegroups.com, alberto....@gmail.com
+1 for clear concise logicless template engines like: Liquid, Django, Nunjucks, Jinja, Swig.

Really, just fall back on consolidate. then we can all annoy the consolidate team to support external consolidate-engine-* plugins, right now consolidate only supports templates hardcoded into the consolidate module.

Todd A

unread,
Feb 21, 2015, 5:41:37 PM2/21/15
to sai...@googlegroups.com
Anyone try Dustjs? I found it thanks to the comments in /config/views.js, turns out LinkedIn evaluated a bunch of them and chose Dustjs, now there's a Linkedin fork of it:


Ambroise Dhenain

unread,
Feb 21, 2015, 5:52:57 PM2/21/15
to Todd A, sai...@googlegroups.com
Thanks a lot for these links, quite interesting even if it's 2+ years old !

When I did my own research, one year ago and 8 months ago, I also liked a bit Dust but didn't try it out, but it definitively was one of the template engine that sounded promising at the time.

Robert Main

unread,
Feb 21, 2015, 10:44:37 PM2/21/15
to Ambroise Dhenain, Todd A, sai...@googlegroups.com

I'm going to reiterate what I said the last time this thread popped up: "literally anything but jade."

Dave Sag

unread,
Feb 21, 2015, 10:58:31 PM2/21/15
to Robert Main, Ambroise Dhenain, Todd A, sai...@googlegroups.com
+1 for jade. I love it.  Like Slim but more flexible.

d
signature.asc

Andi Nugroho Dirgantara

unread,
Feb 22, 2015, 8:31:16 PM2/22/15
to sai...@googlegroups.com, lens...@gmail.com, ambroise...@gmail.com, ande...@gmail.com
IMHO, Jade is changes default HTML syntax, it's pretty hard if we work in groups with beginner NodeJs developers or if we already has "templates" for production which is built with standard HTML syntax. Dust.js is good for replacing "default" engine since it's not pretty hard to learn and also still maintain HTML syntax as well as EJS with stream (async) capability.

Dave Sag

unread,
Feb 22, 2015, 10:05:00 PM2/22/15
to Andi Nugroho Dirgantara, sai...@googlegroups.com, Robert Main, Vadorequest Mini Vado, Todd A
I don't really care what the default is, so long as I can keep using Jade, as, personally, I really like it.  I don't really get people's resistance to it.  It generates perfectly valid HTML and it's very clean; I found, being used to Slim in Rubyworld, that Jade took me about 20 minutes to get the hang of.  It's trivially easy.
--

Dave Sag
About Me: http://about.me/davesag

Randall Meeker

unread,
Feb 22, 2015, 10:16:37 PM2/22/15
to sai...@googlegroups.com, lens...@gmail.com, ambroise...@gmail.com, ande...@gmail.com
I don't think Jade changes default html syntax, but what it does is formalizes the syntax. It does wonders for keeping code clean and tidy in big groups. The writing of straight HTML has gotten sloppy, Jade cleans it up without having conform to a big style guide. 

It takes less than a few minutes to learn and express uses it instead of ejs as its primary example for a template language. 

I get why some people don't like it and their is a lot of personal preference going on, but I don't think it really matters. In the end the default language will probably be whatever the core team uses most often I would assume (which is fair). If it does change, they should put up a quick poll somewhere, let everyone vote for a week and then have it be settled.

I'll keep using Jade either way. 

Andi Nugroho Dirgantara

unread,
Feb 22, 2015, 10:51:28 PM2/22/15
to Randall Meeker, sai...@googlegroups.com, lens...@gmail.com, ambroise...@gmail.com, ande...@gmail.com
I also agree that Jade is great, no doubt since I also use it in any of my projects. I mean with "change syntax" is when we create a template with it, we must rewrite much of our already designed template, for example if we buy a template from Themeforest. Yes it's not that difficult but it took much time.

In terms of "Sails default template" that the power of Sails is in the framework it self, I like the way Sails do today, conventional and common approach. Like just no Coffee Script, just pure JS, but without restriction if we would like to use Coffee Script in our own project. So Sails it self as a framework can focus on make a better framework for us, the other template engine groups will also provide their best, while our as a developer can focus on our project that maybe use Sails's default setting or not.

Wonder if Sails is use Coffee Script as a default, or maybe Dart or Type Script, yes their performance and feature are great but I think many developers will be more resistance with it and take away another framework. It is same as not all of us focus on front end and template engine, many of us use NodeJS with Sails as a back end API service, and when we want to create a simple HTML view maybe for API debugging or something, it will be easy if it stay in pure HTML syntax as it is not necessary to learn another engine.


----------------------------------------------------------------------------------
Andi N. Dirgantara
Platform Developer
NoLimit Indonesia

Dave Sag

unread,
Feb 22, 2015, 11:39:09 PM2/22/15
to Andi Nugroho Dirgantara, sai...@googlegroups.com
What you say makes sense.  So yes the default should be as close to vanilla HTML as possible. I assume it's easy to mix and match page templates however - some some pages use EJS, some use Handlebars, some use Jade etc.  I've certainly seen this done in Rails apps where people mix Slim, Haml and ERB at will.

So long as I am able to use Jade in my own projects I'll be happy with whatever default is selected.

Cheers

D

Robert Main

unread,
Feb 23, 2015, 2:05:47 AM2/23/15
to Dave Sag, Andi Nugroho Dirgantara, sai...@googlegroups.com

Personally, I dislike jade firstly because it's syntax is (in my opinion) dog ugly, secondly because no editor I could find would actually syntax highlight it and thirdly because it feels like I'm just writing html without the <>s.

Dave Sag

unread,
Feb 23, 2015, 2:21:35 AM2/23/15
to Robert Main, Andi Nugroho Dirgantara, sai...@googlegroups.com
TextMate does Jade syntax highlighting just fine. 

What I love about it, apart from the lack of <..>, is the way the blocks work, enabling you to inject content up the layout hierarchy. I've not seen another template language able to do that quite as elegantly. 

D

Sent from my iPhone

Robert Main

unread,
Feb 23, 2015, 5:02:46 AM2/23/15
to Dave Sag, Andi Nugroho Dirgantara, sai...@googlegroups.com

Yes, but we don't all have Textmate...

Randall Meeker

unread,
Feb 23, 2015, 11:31:54 AM2/23/15
to sai...@googlegroups.com, dav...@gmail.com, andi.n.d...@gmail.com

Textmate , Sublime, Cloud 9, Brackets, IntelliJ, RubyMine, PhpStorm, PyCharm, Eclips, Komodo.  Everything supports jade. And even if it didn't in the past, it's a tabbed language,  you don't even need syntax highlighting to easily scan it. Nor do you need a linter to ensure your writing valid html. It is visually intuitive without highlighting. 

And I get that it's an opinion, but "ugly" ? Compared to what? Calling it ugly is like calling out anyone of the 7 dwarves for being short. 

Poletaev Roman

unread,
Mar 3, 2015, 10:33:21 AM3/3/15
to sai...@googlegroups.com
Jade +1

Todd Geist

unread,
Mar 3, 2015, 11:13:04 AM3/3/15
to Poletaev Roman, sai...@googlegroups.com
React +1

I know it isn't a "template" engine.  But it seems have some really solid ideas about to generate HTML on both sever and the the client.

Todd

On Tue, Mar 3, 2015 at 7:33 AM, Poletaev Roman <los...@gmail.com> wrote:
Jade +1



--
Todd Geist

Felipe Roman

unread,
May 15, 2015, 6:35:13 PM5/15/15
to sai...@googlegroups.com
+1 Jade
Reply all
Reply to author
Forward
0 new messages