baryshev / ect

Fastest JavaScript template engine with embedded CoffeeScript syntax
http://ectjs.com
MIT License
626 stars 69 forks source link

multiple root folder #90

Open qataruniversity opened 9 years ago

qataruniversity commented 9 years ago

Can I add multiple root folder ? I mean different folder containing ect templates and if yes, how can I do it?

BilalBoulifa commented 9 years ago

+1

dsamms commented 9 years ago

I use Express. Here is how I get ECT to work with multiple sub-directories.

APP

// View Engine setup var ECT = require('ect'); // NOTE: always watch, otherwise directory changes are not detected var ectRenderer = ECT({ watch: true, root: path.join(dirname, 'src') }); app.engine('.ect', ectRenderer.render); app.set('view engine', 'ect'); app.set('views root', path.join(dirname, 'src'));

ROUTER (in sub-directories)

router.use(function(req, res, next) { res.app.set('views', __dirname); next(); });