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
how to use template with express 3.x? #150
Comments
is npm install working? For LinkedIn Dust $ npm install dustjs-linkedin $ npm install dustjs-helpers |
yeah. i installed both of those -- I just need an example of what to put in app.js to get it working. I tried this, but it is not working: |
That doesn't work... var dust = require('dust') Error: Cannot find module 'dust' On Wed, Sep 19, 2012 at 12:24 AM, Veena Basavaraj
Anthony Ettinger |
trying your code snippet locally |
thanks. i did not run 'npm install dust' -- i figured that is obsolete now. |
same issue i am pretty sure the npm publish is the issue. @jairodemorais can you look into this, it is really bad we have it in this state |
hi @chovy, I will explain u how you should use express 3.x with dustjs-linkedin.
"view engine" just sets the default and that app.engine just maps what engine to use for a given file extension. so you should do something like this: app.set('view engine', 'dustjs-linkedin');
app.set('views', __dirname + '/views');
app.engine('dust', dust.compileFromPath); There is only one problem with this is that the method compileFromPath doesn't exist in dust :p. You should add a method in the dust object with this signature that Express expects: (path, options, callback) you can read more about this here: http://expressjs.com/api.html#app.engine. Another option would be to use consolidate (http://spalatnik.com/blog/?p=54) but unfortunately Consolidate doesn't support the dustjs-linkedin version it only support the old dust version. |
So much for express3:( thanks @jairodemorais , would you know how to get our fork into consolidate? |
we should send a pull request in his repo supporting our fork. :) https://github.com/visionmedia/consolidate.js |
It looks to me like he supports dustjs-linkedin: https://github.com/visionmedia/consolidate.js/blob/master/lib/consolidate.js look at around 135. On Wed, Sep 19, 2012 at 10:00 AM, Jairo de Morais
Anthony Ettinger |
@chovy can you try the consolidate approach then? if it works, we will update the stackoverflow thread, |
500 Error: ENOENT, open 'base.dust'Still doesn't work when I goto /test1 #./views/test1.dust: #./views/base.dust #app.js app.engine('dust', cons.dust); app.get('/test1', test.test1); #./routes/test.js On Wed, Sep 19, 2012 at 10:32 AM, Veena Basavaraj
Anthony Ettinger |
any idea what the problem is? |
I uploaded an example. If I use a regular dust template it works, but as soon as I try a partial it fails: |
silly q, how are these partials loaded? dont see a load source |
nm, it was indeed silly, the render loads and compiles if not there in dust cache |
The index.dust template is supposed to override the content block in base.dust...but I get an error. https://github.com/chovy/express-template-demo/tree/master/demo/views 500 Error: ENOENT, open 'base' unless I'm mistaken, this is how you're supposed to use a main layout with dust. |
I saw your comment on my stackoverflow question: http://stackoverflow.com/questions/12207272/500-error-enoent-open-c-users-gilbert-documents-github-maths4me-base-dust-w/ With consolidate.js partials aren't loaded relative to the views folder, there loaded relative to app root. Have you accounted for this in your template? |
I tried and it still doesn't work: 500 SyntaxError: Expected buffer, comment, partial, reference, section or On Sun, Sep 23, 2012 at 4:08 AM, Gilbert Bishop-White <
Anthony Ettinger |
You have a syntax error. Partials are self closing tags.
|
Thanks. also the "/" needs to be removed. {>"views/base.dust"/} |
Nice, @chovy looks like you were able to get it working.! |
yeah, i put a demo up on github. |
Lovely. It would be good to link this off the main wiki page. http://linkedin.github.com/dustjs/ Just did it! |
I don't see the link, but thanks. |
done! |
var dust = require('dustjs-linkedin');
app.set('view engine', 'dust');
I get an error:500 Error: Cannot find module 'dust'
The text was updated successfully, but these errors were encountered: