0
如何更改Vash的默認文件擴展名?我想在Visual Studio 2015中使用語法突出顯示,所以我想將擴展名從.vash改爲.html。針對vs2015語法突出顯示將vash的默認文件擴展名從.vash更改爲.html
我讀,我應該可以做這樣的事情:
app.engine("html", require("vash").__express);
但我想不通的語法,或者我在錯誤的順序的命令。
我的代碼與.vash文件一起工作,但如果我嘗試更改爲.html,則會出現以下錯誤。我已確認該文件夾中確實存在index.html文件。
無法查找視圖 「指數」 在views目錄IQuestions.FrontEnd \意見」
var http = require("http");
var express = require("express");
var path = require("path");
var logger = require("morgan");
var cookieParser = require("cookie-parser");
var bodyParser = require("body-parser");
var routes = require("./routes/index");
var users = require("./routes/users");
var app = express();
// view engine setup
app.set("views", path.join(__dirname, "views"));
app.engine("html", require("vash").__express);
app.set("view engine", "vash");
app.set("port", process.env.PORT || 3000);
app.use(logger("dev"));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(require("stylus").middleware(path.join(__dirname, "public")));
app.use(express.static(path.join(__dirname, "public")));
app.use("/", routes);
app.use("/users", users);
// catch 404 and forward to error handler
app.use(function (req, res, next) {
var err = new Error("Not Found");
err.status = 404;
next(err);
});
// error handlers
// development error handler
// will print stacktrace
if (app.get("env") === "development") {
app.use(function (err, req, res, next) {
res.status(err.status || 500);
res.render("error", {
message: err.message,
error: err
});
});
}
// production error handler
// no stacktraces leaked to user
app.use(function (err, req, res, next) {
res.status(err.status || 500);
res.render("error", {
message: err.message,
error: {}
});
});
module.exports = app;
http.createServer(app).listen(app.get("port"), function() {
console.log("Express server listening on port " + app.get("port"));
});
的VASH社會似乎並不很活躍所以我轉向帕格 – Hoppe