[英]Precompile dust.js templates on the command line
我對使用dust.js感興趣,並且出於效率原因我想要預編譯模板。
為了自動化編譯過程,我希望能夠從命令行執行此操作。 從網站上看,我似乎必須使用瀏覽器來編譯模板。 有命令行解決方案嗎?
有一種方法可以使用命令行自動化編譯過程。 首先,你需要安裝dustjs-linkedin:
$ npm install -g dustjs-linkedin
然后你可以使用命令dustc :
dustc
$ dustc input_file.tl output_file.js
您還可以使用--name標志為模板指定名稱:
--name
$ dustc --name=dust_fun dust_is_fun.tl dust_is_fun.js
有關更多信息,請查看LinkedIn GitHub頁面上的Dust。
自從2.6版本的dustjs以來, dustc已被完全重寫(但語法幾乎完全相同), 此處提供了文檔。
已經編寫了幾個命令行觀察器來執行此操作,以便在文件更改時自動編譯。 以下是一些:
所有這些都是自動化smfoote詳細說明的dustc命令。
[英]Is it possible to render dust.js templates synchronously?
[英]Parent - child templates (dust.js)
[英]Dust.js if Statement
[英]Dust.js and tables
[英]compiling and rendering complex Dust.js templates on the client
[英]dust.js templates: How to render a section asynchronously?
[英]Dust.js external template
[英]Dust.js with inline JavaScript
[英]Dust.js if value in array
[英]Dust.js Promise Array
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.