Node.js module for compiling *.dust templates.
Add the following dependency into your package.json
:
"dust-compiler": "git+https://github.com/vadim-zverugo/dust-compiler.git"
And load this dependency:
npm install
require('dust-compiler').init({
sourceDir: '/views',
compiledDir: '/public/dust'
});
sourceDir
(required): directory with *.dust templates for compilation.compiledDir
(required): destination directory where compiled js files will be saved.logger
(optional, defaults toconsole
): custom logger (should provide .error() and .info() methods).syncCompilation
(optional, defaults tofalse
): compile all dust templates synchronously. By default another processes don't wait while compiler will finish compilation.clearCompiled
(optional, defaults totrue
): remove all compiled js files before launching new compilation.preProcessors
(optional, defaults to[]
): functions to process template content before compilation. Each function accepts two argumentstemplateContent
andtemplateFilename
and have to return processed content.postProcessors
(optional, defaults to[]
): funtions to process compiled js content. Each function accepts two argumentscompiledContent
andcompiledFilename
and have to return processed content.watchFiles
(optional, defaults totrue
): allows to re-compile *.dust templates when source file changes.subDirSeparator
(optional, defaults to__
): is used to identify compiled js template as a separator of sub-directories.compileAll
(optional, defaults tofalse
): allows to collect all compiled js templates in one filecompiledAllFilename
.js.compiledAllFilename
(optional, defaults toall
): name of the file with all compiled js templates.
Open test
directory and launch nodeunit
:
nodeunit compilerTest.js