akdubya / dustjs

Asynchronous templates for the browser and node.js
http://akdubya.github.com/dustjs/
MIT License
1.44k stars 131 forks source link

Added a CLI that can compile .dust to .js as well as watch files and/or directories for changes and recompile #44

Open dinedal opened 12 years ago

dinedal commented 12 years ago

Code adapted from: https://raw.github.com/jashkenas/coffee-script/master/lib/coffee-script/command.js

I understand this introduces a dependency of optimist. If this is a problem I'm happy to remove it, but optimist is pretty light weight, and reinventing the argument parsing wheel is kinda boring.

More then willing to clean up this code and am open for comments, just let me know and I'll make the changes.

Dust really could use the feature of it's own CLI to encourage adoption.

kmiyashiro commented 12 years ago

Should just use https://github.com/cowboy/grunt

soci-viii commented 12 years ago

i forked/updated the very old connect-compiler with dust support. the original source is all wrong: it stats files and looks at touched times, when really we need to use any of the dozens of various node-watch*'s to proactively update as opposed to continually re-checking. but it's good enough for development (oh no! 6ms instead of 1ms!) and if you're not compiling static assets in prod well so help you. https://github.com/socialtables/connect-compiler

akaihola commented 12 years ago

I just created a pull request to the linkedin fork of dustjs for my command-line compiler script. I modeled it after lessc in the LESS project, and it doesn't have other dependencies than path, fs and util. Unfortunately LinkedIn's fork isn't a fork of this repository, so I guess it isn't possible to merge it in.