Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

dust-compiler

jamsyoung104MIT0.3.9

Dust.js template watcher/compiler with support for notifications on OS X, Linux, and even Windows

compiler, dust compiler, dust, dust.js, dustjs, dustjs-linkedin, notification center, notify-send, terminal-notifier

readme

Dust Compiler

This is a basic dust compiler, there are many out there. This one adds support for the OS X 10.8.x Notification Center and notifications on modern Linux desktops to bring more visiblity to compile errors when developing while the terminal window that it is running in is not visible.

Build Status NPM version Dependency Status Bitdeli Badge

Install

It is recommended to install this globally so you can have dust-copmiler to run from any location on your machine, for any project you are working on.

$ npm install -g dust-compiler

File Extension

Expectation is that the files being compiled end in the .dust file extension

Enabling notifications in Linux

Many Linux distributions ship with the notify-send tool already installed. If not, you will need to install the "libnotify-bin" (Ubuntu) or "libnotify" (RedHat / Fedora) packages.

Turning it on

To fire it up just do this:

$ dust-compiler -s source_path -d destination_path

Notifications will look like this:

Success!

or Failure :(

Bootstrapping

In cases where you are creating a new project and have lots of existing dust templates, you will want to bootstrap the files. To save time you can run the following to automatically build everything in the source folder.

$ dust-compiler -s source_path -d destination_path --bootstrap

Disabling notifications

Don't like the notifications? Prefer to watch the terminal window instead?

$ dust-compiler -s source_path -d destination_path --nonotify

Include path in compiled template name

This may not be of value to everyone, but it is to me. In some conditions you may need the name of the compiled template that is registered in the Dust.js cache to include the path. Using the same templates on server side and client side may require this. I added a switch for that.

$ dust-compiler -s source_path -d destination_path --includepath

AMD

If you need your compiled template to be output AMD style you can add a --amd flag. This will wrap it with the following, where COMPILED_TEMPLATE contains the compiled template. I don't personally use templates this way. If this feature needs to be optimized, add details to issue #14 or open a new issue.

define(["dust"], function () { dust = require("dust"); COMPILED_TEMPLATE });

Overloading arguments

You can load up your command line with just about everything.

$ dust-compiler -s source_path -d destination_path --bootstrap --includepath --nonotify --amd

Development

Common Tasks

Look in the Gruntfile.js for more details.

  • grunt test - Runs all of the completed grunt test tasks.

  • npm run build-man - Builds the man page.

changelog

Change Log

0.3.9

  • updated dependencies

    • debug-0.8.1 => 1.0.2
    • dustjs-linkedin-2.3.5 => 2.4.0
    • grunt-0.4.4 => 0.4.5
    • grunt-complexity-0.1.6 => 0.2.0
    • grunt-mocha-test-0.10.2 => 0.11.0
  • fixed a defect that was causing logging to not work at all

0.3.0

  • adding --amd flag for AMD support

0.2.0

  • restructured to have an internal library (lib/compile.js) that could be used indpendent of the command line wrapper.

  • pulled the log notification pieces out into a stand alone log-notify npm package which is included as a dependency

  • added lots of unit tests and mock data to test against

  • got blanket coverage working (kinda) - fixes issue #16

  • issue #15 should not cause any problems, as far as I can tell.

0.1.2

  • Updated README

0.1.1

  • Updated dustjs-linkedin to 2.0.3

0.1.0

  • no functional changes, minor version bumped because it should have always been 0.1.x from the beginning.

  • updated colors to 0.6.2

  • updated dustjs-linkedin to 2.0.2

  • added lots of dev dependencies to support grunt test tasks

  • added a man page, now you can do man dust-compiler from a shell if desired

0.0.9

  • EXPERIMENTAL - added support for Windows notification via growl (ZoogieZork)

  • switched Linux notification to hit notify-send via grow (ZoogieZork)

  • upgraded dustjs-linkedin to 1.2.4

  • added -v|--version argument to display the version installed

  • changed how -s|--source and -d|--destination arguments processed

  • reverted --bootstrap to only build, it does not watch anymore

0.0.8

  • code refactoring - made variable names make more sense

  • fixed a defect with error messages not being properly displayed by terminal-notify in the OS X notification center

  • Issue #10 - clearer identification of error messages

0.0.7

  • modified to not include the .dust extension in the registered name of the compiled dust template (CRHain88)

0.0.6

  • updated watch to 0.7.0

  • updated dustjs-linkedin to 1.2.3

  • updated mkdirp to 0.3.5

  • added optimist support for handling command line arguments

  • added colors support for fancy command line colors when output is written to the console

  • Issue #4 - added support for recursing directories

  • Issue #2 - added -s|--source argument for passing in the source directory

  • Issue #2 - added -d|--destination argument for passing in the destination directory

  • Issue #8 - added --includepath argument to include the path in the compiled template as the name

  • changed --no-notify to --nonotify

  • improved output to be more verbose

  • modified --bootstrap to watch after it bootstraps, so no need to re-run the compiler after a bootstrap

  • Issue #3 - Now traps when source or destination path does not exist

0.0.5

  • added support notifications on Linux via notify-send

  • added --no-notify option for platforms that do not have notify-send or terminal-notifier support, or people that just don't want to see any notifications

  • --bootstrap option skips directories (vs. crashing)

0.0.4

  • initial published version