![](/img/trans.png)
[英]How do I convert my server-side ASP XmlHttpRequest code to client-side JavaScript?
[英]How do I render my pug files to html on the client-side instead of server-side
I have an existing webpage in HTML, CSS, JavaScript & JQuery without a server-side but at the moment I want to use pug to render my views from the client-side without having to serve the files from the server.
如果我要从服务器呈现我的视图,我知道如何 go 关于它,但我主要关心的是从客户端进行。
我知道我必须使用pug-cli
来实现这一点。 我已经浏览了 API 文档: https://pugjs.org/api/reference.html但我似乎没有抓住它。 如果我能更好、更简单地解释该怎么做,我会很高兴。
<script>
标签的 HTML 中。 您可以使用 npm ( npm install pug
) 或从https://github.com/pugjs/pug/releases下载它。render()
function 将 pug 代码转换为 HTML。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.