Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

root folder is ignored #99

Open
kortac opened this issue May 10, 2016 · 1 comment
Open

root folder is ignored #99

kortac opened this issue May 10, 2016 · 1 comment

Comments

@kortac
Copy link

kortac commented May 10, 2016

You can change the root folder option but it is always ignored:

/**
 * Created by korial on 10.05.16.
 */

var express         = require("express");
var ECT             = require("ect");
var path            = require("path");

var viewsRoot       = path.join(__dirname, "gui", "views");
var ectRenderer     = ECT({watch: false, root: viewsRoot, ext: ".ect"});

var app = express();

app.set("view engine", "ect");
app.set("views root", viewsRoot);
app.engine("ect", ectRenderer.render);

console.log(viewsRoot);

app.use((req, res) => {
    res.render("frontend/home", {});
});

app.listen(8080, "0.0.0.0", () => {
    console.log("Server listening on...");
});

And the console output:

/home/korial/test/gui/views
Server listening on...
Error: Failed to lookup view "frontend/home" in views directory "/home/korial/test/views"

Tested with express 4.13.4 and ECT 0.5.9

@kortac
Copy link
Author

kortac commented May 10, 2016

Ok, got it. The root folder option only applies to includes within templates.

Is it possible to also affect res.render?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant