繁体   English   中英

如何在客户端而不是服务器端将我的哈巴狗文件渲染到 html

[英]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但我似乎没有抓住它。 如果我能更好、更简单地解释该怎么做,我会很高兴。

  1. 下载库并将其加载到带有<script>标签的 HTML 中。 您可以使用 npm ( npm install pug ) 或从https://github.com/pugjs/pug/releases下载它。
  2. 使用render() function 将 pug 代码转换为 HTML。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM