Sails.js: using dust in sails 0.10.5

I am trying to migrate a project from 0.9.9 to 0.10.5

We used a dust motor in our box instead of the standard ejs motor.

Config / views.js file content

module.exports.views = {
  engine: 'dust',
  layout: 'layout'


In my controller, I was able to render this view like this

res.view('layout', obj);


However, in sails 0.10.5, when I set the sails up, the first thing I get is this warning

warn: Sails' built-in layout support only works with the `ejs` view engine.
warn: You're using `dust`.
warn: Ignoring `sails.config.views.layout`...


And then when I try to render the view like I did earlier, I get the following error:

error: Sending 500 ("Server Error") response: 
 Error: ENOENT, open '/.dust'

 { [Error: ENOENT, open '/.dust'] errno: 34, code: 'ENOENT', path: '/.dust' }


Any idea what is the correct way to do this in 0.10.5?


source to share

1 answer

Property layout

does not apply to dust (ejs only). Set layout to false

to clear the warning. You want to use Dust's built-in support for partials and locks.

Usage res.view('layout', obj);

means that you expect a file named views/layout.dust

. Prior to 0.10 sails included a property layout

from config / views.js as part of the path.

So, I think your call is res.view()

actually being called with an empty string as the first parameter, and it does not break because you tried to do something called layout

. I would check your call to make sure you are calling res.view()

with the variable you created.



All Articles