![](/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.