krakenjs / kraken-js

An express-based Node.js web application bootstrapping module.
Other
4.94k stars 459 forks source link

dust-helper can't work #163

Closed mani95lisa closed 10 years ago

mani95lisa commented 10 years ago

I used {@eq} in my dust template, it works fine on it's test website : http://linkedin.github.io/dustjs/test/test.html

But didn't work in kraken. Could anybody tell me what's wrong with it?

data:

{path:"home"}

dust:

{@eq key=path value="home"}ok{/eq}

it could got ok on test website, but can't on my kraken application.

Thanks for your help!

mani95lisa commented 10 years ago

I found it works fine in kraken 6.1, but not in 7.1, anybody have solution? Thanks!

mani95lisa commented 10 years ago

I found that makara@0.3.4 wants dustjs-linkedin@^2.0.0, but kraken-js 0.7.1 dustjs is "~2.0.3". Maybe it's the problem, right?

grawk commented 10 years ago

I've just created a sample application with the latest generator (pulling in kraken-js 0.7.1 and makara 0.3.4) and was able to use the {@eq} helper per your instructions with no issue. I simply modified the default index.dust template as follows:

{>"layouts/master" /}

{<body}
    <h1>{@pre type="content" key="greeting"/}</h1>
    {@eq key=path value="home"}<p>ok</p>{/eq}
{/body}

and the model file index.js as follows:

'use strict';

module.exports = function IndexModel() {
    return {
        name: 'krakensample',
        path: "home"
    };
};

I can toggle "ok" on and off simply by changing the value of path, as you would expect.

I don't think this is due to the makara dustjs-linkedin dependency. Due to the more restrictive dustjs-linked in dependency in the generator generated sample app, I got dustjs-linkedin 2.0.3 installed.

I then updated dustjs-linkedin in package.json to match what is in makara (^2.0.0). I see the same correct behavior from the dust helper with dustjs-linkedin version 2.3.4 installed.

mani95lisa commented 10 years ago

@grawk Thanks for your reply, I tried again in empy Kraken project.

You're right, I just install dust-helpers 1.2.0 in my working project, so it doesn't work, change it to 1.1.2, everything works fine.

Thanks!