Node or Express partials without templating

740 views
Skip to first unread message

// ravi

unread,
Apr 2, 2013, 11:09:31 AM4/2/13
to nod...@googlegroups.com

Hello all,

I am afraid the answer is going to be “nope”, but asking anyway before I go off to implement my own middleware: is there a good way to do the equivalent of server-side includes, or partials, with Node/Express *without* using a template engine (Jade, Hogan, etc)?

Regards,

—ravi

Dominik Kienzler

unread,
Apr 2, 2013, 11:38:49 AM4/2/13
to nod...@googlegroups.com
Hi,

you need SOME kind of template engine if you want to work with variables
or something like that in your html templates, for partials you would at
least need some kind of placeholder in a html file which you can replace
by the partial code.

regards,
Dominik


Am 02.04.2013 17:09, schrieb // ravi:
> Hello all,
>
> I am afraid the answer is going to be �nope�, but asking anyway before I go off to implement my own middleware: is there a good way to do the equivalent of server-side includes, or partials, with Node/Express *without* using a template engine (Jade, Hogan, etc)?
>
> Regards,
>
> �ravi
>

henrique matias

unread,
Apr 2, 2013, 11:51:55 AM4/2/13
to nod...@googlegroups.com
sorry for the personal question, but why not use jade ?
seems such a nice solution for templates


On 2 April 2013 16:38, Dominik Kienzler <d.kie...@dominik-kienzler.de> wrote:
Hi,

you need SOME kind of template engine if you want to work with variables or something like that in your html templates, for partials you would at least need some kind of placeholder in a html file which you can replace by the partial code.

regards,
Dominik


Am 02.04.2013 17:09, schrieb // ravi:

Hello all,

I am afraid the answer is going to be “nope”, but asking anyway before I go off to implement my own middleware: is there a good way to do the equivalent of server-side includes, or partials, with Node/Express *without* using a template engine (Jade, Hogan, etc)?

Regards,

        —ravi


--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



// ravi

unread,
Apr 2, 2013, 1:56:25 PM4/2/13
to nod...@googlegroups.com
On Apr 2, 2013, at 11:38 AM, Dominik Kienzler <d.kie...@dominik-kienzler.de> wrote:
>
> you need SOME kind of template engine if you want to work with variables or something like that in your html templates, for partials you would at least need some kind of placeholder in a html file which you can replace by the partial code.
>

Hello Dominik,

thank you for the response. I do not have any variables in my HTML templates (partials) because I use TransparencyJS to fill in my data (Transparency is DOM based and requires no DSL). All I need is to be able to break my single-page app’s HTML into separate files (header, footer, etc) for easier maintenance, and have them joined up similar to how the old SSI used to work. Or even just compiled beforehand.


On Apr 2, 2013, at 11:51 AM, henrique matias <hems....@gmail.com> wrote:
> sorry for the personal question, but why not use jade ?
> seems such a nice solution for templates
>


Hello Henrique,

not personal at all :-). I don’t use Jade because I am not in favour of DSLs (or equivalent). I know HTML, it works with my editors/plugins/toolchain. With TransparencyJS I do not need the templating and logic provided by templating engines like Jade (I am also philosophically disinclined to mix logic into UI, as most templating engines do).

Appreciate the response from both of you,

—ravi


P.S: I decided to buy CodeKit (yes, I realise the DSL’ishness of it) and deal with my problem outside of Node/Express. But if anyone has suggestions I would still love to hear them, and am grateful for them.

greelgorke

unread,
Apr 3, 2013, 6:43:26 AM4/3/13
to nod...@googlegroups.com
use ejs https://github.com/visionmedia/ejs#includes its as much plain html as you wish

henrique matias

unread,
Apr 3, 2013, 8:07:51 AM4/3/13
to nod...@googlegroups.com
cool, looks like you already have very solid solutions!


We ( at work ) use jade. Although you can add logic to the template, what end up happening is actually a fat a model / light view that is able to prepare the data for the template so the template end up with very simple logic - or no logic at all.

Actually we use coffee / jade / stylus, and we're very happy, specially with the "indentation" requirement / not having to close tags and curly braces. it makes everything way more readable, standardised and faster.

But i understand, everyone has it own "pipe line" / "tool chain" and i think in the end what matters is how comfortable and how easy you feel it is!

may the force be with all of us!


--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.

Floby

unread,
Apr 4, 2013, 12:28:58 PM4/4/13
to nod...@googlegroups.com
here comes my shameless plug.
I've been working on a new version of 'blue' with new streams. Basically you can include files from files. it's an ejs-like syntax.
Reply all
Reply to author
Forward
0 new messages