最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Precompile dust.js templates on the command line - Stack Overflow

programmeradmin7浏览0评论

I'm interested in using dust.js, and I'd want to prepile the templates for efficiency reasons.

To automate the pilation process, I'd like to be able to do this from the mand line. From the website, it seems that I'd have to use a browser to pile the templates. Is there a mand line solution?

I'm interested in using dust.js, and I'd want to prepile the templates for efficiency reasons.

To automate the pilation process, I'd like to be able to do this from the mand line. From the website, it seems that I'd have to use a browser to pile the templates. Is there a mand line solution?

Share Improve this question asked Jan 26, 2013 at 4:58 minouminou 16.6k21 gold badges74 silver badges118 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

There is a way to automate the pilation process using the mand line. First, you need to install dustjs-linkedin:

$ npm install -g dustjs-linkedin

Then you can use the mand dustc:

$ dustc input_file.tl output_file.js

You can also specify a name for the template by using the --name flag:

$ dustc --name=dust_fun dust_is_fun.tl dust_is_fun.js

For more info, take a look at the Dust by LinkedIn GitHub page.

dustc has been pletely rewritten since version 2.6 of dustjs (however the syntax is almost identical), documentation is available here.

There are several mand line watchers that have been written to do this as well to automatically pile when a file changes. Here are a few:

  • https://github./dmix/dusterjs
  • https://github./mutualmobile/dust_piler
  • https://github./jamsyoung/dust-piler

All these do is automate the dustc mand that smfoote has detailed.

发布评论

评论列表(0)

  1. 暂无评论