Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Express and Hogan.js Partials

Received: by 10.180.107.38 with SMTP id gz6mr1270941wib.0.1348760437412;
        Thu, 27 Sep 2012 08:40:37 -0700 (PDT)
X-BeenThere: express-js@googlegroups.com
Received: by 10.180.99.65 with SMTP id eo1ls4473591wib.1.gmail; Thu, 27 Sep
 2012 08:40:17 -0700 (PDT)
Received: by 10.180.107.167 with SMTP id hd7mr1265643wib.0.1348760417658;
        Thu, 27 Sep 2012 08:40:17 -0700 (PDT)
Received: by 10.216.101.133 with SMTP id b5msweg;
        Thu, 27 Sep 2012 06:41:12 -0700 (PDT)
Received: by 10.50.0.148 with SMTP id 20mr8191294ige.3.1348753271300;
        Thu, 27 Sep 2012 06:41:11 -0700 (PDT)
Received: by 10.50.0.148 with SMTP id 20mr8191292ige.3.1348753271289;
        Thu, 27 Sep 2012 06:41:11 -0700 (PDT)
Return-Path: <longs...@gmail.com>
Received: from mail-oa0-f47.google.com (mail-oa0-f47.google.com [209.85.219.47])
        by gmr-mx.google.com with ESMTPS id s9si2651913igw.0.2012.09.27.06.41.11
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 27 Sep 2012 06:41:11 -0700 (PDT)
Received-SPF: pass (google.com: domain of longs...@gmail.com designates 209.85.219.47 as permitted sender) client-ip=209.85.219.47;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of longs...@gmail.com designates 209.85.219.47 as permitted sender) smtp.mail=longs...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-oa0-f47.google.com with SMTP id h1so1301681oag.6
        for <express-js@googlegroups.com>; Thu, 27 Sep 2012 06:41:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type;
        bh=eLX1mRhGCQabzJQPTD58Q3+bLmoYsczcGIi0nDcjpf4=;
        b=lnK4q5r+1VrbkqMqTv/dvCw/KxpsrkkPvhOSvCJAsRD9EExNXkOIkayUxlLLWPxG/L
         IGy0EFgjcenqqSF9AChViUVrNG/ND/t/Y/F4u2quomSouvp7lNBLGazzssPcTM/bh/5N
         67MPQuFhkrrhivFN7p9LBJiykP381Ecf2u3Cx3TMlzV4Mc2PMcGqoGERQX05R8LA3sqI
         wJogwEvA++FNNchN7fs3jo04ogctPEjFVKw7p79kVUJd6/lgP0XnRaw82gU0CIa+kLxh
         Ve8lUW1VYzEmGoSOE2T0MROmNmOgEwECJnOdJfyVVve+WLg9/VqQeTVcsyvT1eiByBD7
         PR4A==
MIME-Version: 1.0
Received: by 10.182.202.39 with SMTP id kf7mr3204779obc.37.1348753270817; Thu,
 27 Sep 2012 06:41:10 -0700 (PDT)
Received: by 10.76.114.231 with HTTP; Thu, 27 Sep 2012 06:41:10 -0700 (PDT)
In-Reply-To: <60852807-3815-4d41-b85c-6160129e4123@googlegroups.com>
References: <b2c859fc-d66e-489c-b32e-753333ca4d2d@googlegroups.com>
	<60852807-3815-4d41-b85c-6160129e4123@googlegroups.com>
Date: Thu, 27 Sep 2012 09:41:10 -0400
Message-ID: <CA+kVbeVU+4oXiOvP2xnfcaf3pBA4o2VCNg=Ve7EB5s7vh0F...@mail.gmail.com>
Subject: Re: [Express-js] Re: Express and Hogan.js Partials
From: James Long <longs...@gmail.com>
To: express-js@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1

If you keep having a lot of problems with this, it might be worth
checking out a different templating engine. I wrote nunjucks, a port
of jinja2, because I was having these kinds of problems over and over.

http://nunjucks.jlongster.com/

All you have to do is:

{% include "about.html" %}

- James

On Wed, Sep 26, 2012 at 2:02 PM, Felix Weiss <felix.we...@gmail.com> wrote:
> Another possible solution:
>
> index.hjs
> <!DOCTYPE html>
> <html>
>   <head>
>     <title>{{ title }}</title>
>   </head>
>   <body>
>     {{ about }}
>   </body>
> </html>
>
> router.js
>     var about = fs.readFileSync('about.hjs', 'utf-8');
>
>     app.get('/', function(req, res) {
>        res.render('index', {
>             title: 'Nested Templates',
>             about: about
>         });
>     });
>
>
>
> Am Sonntag, 2. September 2012 02:52:39 UTC+2 schrieb Felix Weiss:
>>
>> It' great, we can generate an app with Hogan.js support, because Hogan.js
>> is really fast an usually partials are possible. So my question: How can we
>> use partials with Express? Or is this feature still disabled in Express? I
>> tried to get it working, but somehow it doesn't. :-/
>>
>> I would appreciate your hint! :-)
>>
>> layout.hjs
>>>>
>>>> <!DOCTYPE html>
>>>>
>>>> <html>
>>>>
>>>>   <head>
>>>>
>>>>     <title>{{ title }}</title>
>>>>
>>>>     <link rel='stylesheet' href='/stylesheets/style.css' />
>>>>
>>>>   </head>
>>>>
>>>>   <body>
>>>>
>>>>     {{> about }}
>>>>
>>>>   </body>
>>>>
>>>> </html>
>>
>>
>> about.hjs
>>>
>>> <h1>{{ title }}</h1>
>>> <p>Welcome to {{ name }}</p>
>>
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Express" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/express-js/-/iJHPIi90OLUJ.
>
> To post to this group, send email to express-js@googlegroups.com.
> To unsubscribe from this group, send email to
> express-js+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/express-js?hl=en.