Tag: vash

configurationSails.js以使用Vash视图引擎

我一直在试图find有关如何configurationSails以使用Vash视图引擎的信息。 我不确定是否有可能,因为看起来与Sails兼容的视图引擎必须基于consolidate.js。 我不确定Vash是否以巩固为基础,并且一直无法弄清楚是不是。

使用nodejs vash模板通过脚本标记发送数据

我是nodejs的新手。 尝试从使用vash模板的nodejs服务器将带有引导的数据(以用户身份login)发送回带索引页的客户端。 根据用户是否login,需要客户端上的引导数据来启用/禁用某些选项。 server.js看起来像这样: app.get("*", function(req, res) { res.render("index", { title: "Page title", bootstrappedUser: req.user }); }); index.vash @html.extend('layout', function(model) { @html.block("scripts", function(model){ @if(model.bootstrappedUser) { @{ var a = model.bootstrappedUser; } <script type="text/javascript"> window.bootstrappedUser = JSON.stringify(@a); </script> } }) }) 但是这会导致下面的stringify函数的客户端html中出现“UncaughtSyntaxError:Unexpected identifier” <script type="text/javascript"> window.bootstrappedUser = JSON.stringify([object Object]); </script> 我试图在Github上查看Vash页面 ,但几乎没有关于使用vash的脚本块的文档。 我在'index.vash'里面使用了正确的语法,还是有一些我缺less的vashstring插值? 任何帮助将非常感激。

node.js:用vash渲染错误

我在vash中得到了node.js中的渲染错误。 我真的很难看到问题是什么。 下面是导致错误的错误和代码。 TypeError: Problem while rendering template at line 4, character 2. Original message: object is not a function. Context: 2 | @html.block('body', function(model){ 3 | <p>@model.title </p> > 4 | }); 5 | }); 6 | 7 | at helpers.extend.model (C:\Users\user009\Dropbox\cpp\node_modules\vash\build\vash.js:2213:4) at Object.vash.loadFile (C:\Users\user009\Dropbox\cpp\node_modules\vash\build\vash.js:2072:10) at helpers.extend (C:\Users\user009\Dropbox\cpp\node_modules\vash\build\vash.js:2190:8) at eval (eval at <anonymous> (C:\Users\user009\Dropbox\cpp\node_modules\vash\build\vash.js:1820:24), […]