2014-09-26 27 views

回答

13

這個工作對我來說: https://github.com/balderdashy/sails/issues/2188#issuecomment-56994236

配置/ views.js

var minify = require('html-minifier').minify; 
var ejs = require('ejs-locals'); 
var parsing = function(path,options,fn) { 
    options.locals = options.locals || {}; 
    options.locals._layoutFile = 'layout.ejs'; 
    ejs(path, options, function(err, str){ 
     str = minify(str,{collapseWhitespace: true, removeComments: true}); 
     return fn(err, str); 
    }); 

}; 

module.exports.views = { 
    engine: { 
    ext: 'ejs', 
    fn: parsing 
    }, 
    layout: false 
}; 
+1

爲什麼我不能用諧音使用它?我只是嘗試過,並沒有得到它的工作,有一個錯誤代碼30 – Sahan 2014-10-01 11:54:46

+0

我使用partials,它的工作,... – 2014-10-01 12:10:57

+1

我會發布我所有的錯誤和文件在這裏,那麼你可能prob幫助我。 – Sahan 2014-10-01 12:27:58