carefree handlebars template pre-compilation at runtime

Usage no npm install needed!

<script type="module">
  import manchu from '';



fu manchu does not obtain his mighty 'stache without, first, pre-compiling it.


manchu is an easy way to create build directives at your application runtime. it supports the following otherwise manual tasks:

  • handlebars template pre-compilation
  • css/less concatenation and compilation
  • javascript compression and concatenation


$ npm install manchu


this example illustrates how you might do the following:

  1. precompile a directory of handlebars templates
  2. uglify a directory of javascript files
  3. concatenate selected css and less files and minify
var manchu = require('manchu')
  , templates
  , scripts,
  , styles;

templates = manchu.createDirective({
    type : 'handlebars',
    input : __dirname + '/templates',
    output : __dirname + '/public/scripts/templates.js'

scripts = manchu.createDirective({
    type : 'javascript',
    input : __dirname + '/scripts',
    output : __dirname + '/public/scripts/app.js'

styles = manchu.createDirective({
    type : 'stylesheet',
    input : __dirname + '/styles',
    output : __dirname + '/public/styles/styles.css'
], function() {
    // start your server or something

public api


Returns a new Directive instance. The argument options takes the following properties.

  • type - String ('handlebars', 'javascript', 'stylesheet')
    • Type will determine whether to precompile handlebars templates, uglify JavaScript files, or compile LESS
  • input - String or Array
    • This can be a string path to a directory of files to use or and array of individual files or directories
    • The directory read is not recursive and will only read the immediate children of the directory
  • output - String
    • Path to the desired output file., callback)

Accepts an array of Directives and executes them in sequence.

  • directives - Array
    • Pass an array of manchu.Directive instances
  • callback - Function
    • Gets called upon successful build of all directives

Returns a new instance

class reference