How do I change the default path of sails view files?
Perhaps I want to store my views in the / pages directory. The following code in the sails catalog configurations does not restore the browse path:
paths: {
views: path.normalize(__dirname + '/../pages')
}
but the code for the public dir works well:
paths: {
public: path.normalize(__dirname + '/../any_public_dir')
}
What can I do?
+3
source to share
2 answers
If you do not use sails lift
, but have your own application and raise it inside:
var Sails = require('sails');
Sails.lift({}, function(err, server) {});
then you can point the path there
var Sails = require('sails');
Sails.lift({
//environment: 'test', // if you need to set
//hooks:{foo: false}, // if you want to disable some of them
paths: { views: 'mydir/views' }, // relative to appDir
}, function(err, server) {});
You can later (in the sail controllers / services) get the current dir views:
var vdir = sails.config.paths.views;
To get other custom templates console.log(Object.keys(sails.config));
0
source to share