Skip to content
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

Views doesn't work if the main app's default view engine is not jade #1

Closed
rawiroaisen opened this issue Sep 14, 2014 · 3 comments
Closed

Comments

@rawiroaisen
Copy link

Please change

_render: (req, res, template, locals) =>
res.render path.resolve(__dirname, '../views/', template), locals

to

_render: (req, res, template, locals) =>
res.render path.resolve(__dirname, '../views/', template + '.jade'), locals

(added '.jade' suffix)

in file src/index.coffee
in line 314

PS: I don't know how to make pull requests...

aularon added a commit that referenced this issue Sep 17, 2014
@aularon
Copy link
Contributor

aularon commented Sep 17, 2014

The issue is fixed now: There's a .templatesPath that defaults to ./views/%s.jade inside the module directory, one can also override it to set his own views. I will close this issue and the pull request.

Thank you for taking the time and helping the development of this module! :)

@joejean
Copy link

joejean commented May 4, 2015

I'm using nunjucks as my default view engine and when I go to /admin I get a template not found error: "template not found: /home/joe/Documents/chipin/node_modules/penguin/views/index.jade"
I have given all access penguin/views folder. Can you please help me with that issue? Thanks.

@sogko
Copy link
Contributor

sogko commented May 5, 2015

Hi @joejean

You can specify the templatesPath options, for e.g.:

path = require('path')
penguin = require("penguin")
admin = new penguin.Admin {
  templatesPath: path.resolve(__dirname, '../views/', '%s.html')
}
...

Assuming that your nunchucks templates have .html extensions and are in views folder one level up.
node-penguin will replace the %s with the name of the required view.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants