sails can't find layout.jade

落花浮王杯 提交于 2019-12-08 02:06:50

问题


I am starting to learn Sails (0.9.7, node 0.10.16) and running through the sailscasts episodes. I am also trying to use jade as I do so. Where I am stuck now is that sails is not finding views/layout.jade. I backed out all the jade stuff and redid with ejs and sails is not finding views/layout.ejs.

As a last resort, I cloned activtyoverlord (the sailscasts app) and when I sails lift activityoverlord does not find its views/layout.ejs.

Any suggests as to what I might be doing wrong?


回答1:


I'm not a jade user, however, I think you need to put extends ../layout at the top of your index.jade file to use layout.jade.

Also, I think both the layout.jade and index.jade have tabs and spaces (I don't think you can use both). I took out the tabs and added spaces in your layout.ejs file.

I created a project from scratch, changed engine to jade in config/views.js but left layout to the default value.

Also, I used these tags in layout.jade:

 // SCRIPTS
 // SCRIPTS END

and

 // STYLES   
 // STYLE END

Grunt then puts the appropriate paths for javascript and styles in your layout file. I couldn't get index.jade into the layout.jade but I don't know enough about jade to determine what's wrong.

Here's a link to the repo I made: https://github.com/irlnathan/sails-answers-jade



来源:https://stackoverflow.com/questions/20473326/sails-cant-find-layout-jade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!