阻止Node.js呈现嵌入式模板

时间:2014-05-11 20:00:34

标签: javascript node.js templates underscore.js ejs

我在服务器上使用ejs来渲染整个html页面,但我也在html中存储了几个小模板,以便客户端可以在以后渲染它们。如何告诉node.js忽略这些嵌入式模板?

我在服务器端的代码:

app.get('/:template', function(req,res){
    res.render(req.params.template);
});

带有嵌入式模板的示例html:

<body>
    <div><%= serverSideVariable %></div>
    <script type="text/template" id="embedded_template_01">
        <%= clientSideVariable %>
    </script>
</body>

0 个答案:

没有答案
相关问题