gpt4 book ai didi

node.js - 在C9 Cloud IDE 中运行Jade 模板有什么技巧?

转载 作者:搜寻专家 更新时间:2023-11-01 00:02:51 25 4
gpt4 key购买 nike

我正在尝试在 C9 Cloud IDE 中使用 Express (nodejs) 运行一个简单的网络应用程序但是碰巧当我启动应用程序时,IDE 将 .jade 文件视为 JavaScript,并尝试对其进行解释,但出现了很多错误。

例如Jade文件:

h1 Sign Up
form(action="/user", method="POST")
input(type="text", name="user[name]", placeholder="Type your desired user name")
input(type="password", name="user[password]", placeholder="Type your password")
input(type="password", name="user[passwordCheck]", placeholder="Type your password again")

button(value="SIGN UP!")

我得到的错误:

(function (exports, require, module, __filename, __dirname) { h1 Sign Up
^^^^
SyntaxError: Unexpected identifier

有什么配置可以让它工作吗?

最佳答案

Cloud 9 IDE 使用 ACE 文本编辑器,捆绑了对 JS、HTML、CSS 和混合模式的语法高亮支持。来自 ACE指南:

By default, the editor supports plain text mode. All other language modes are available as separate modules, loaded on demand like this:

editor.getSession().setMode("ace/mode/javascript");

所以尝试将它设置为 ace/mode/jade

关于node.js - 在C9 Cloud IDE 中运行Jade 模板有什么技巧?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15499871/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com