node package manager
Orgs are free. Discover, share, and reuse code in your team. Create a free org »



A project builder for g's


$ npm install guilder

For the image resizing you need ImageMagick on your system ## usage

guilder is a toolkit for scaffolding and building projects using source template folders.

It has tools for the following jobs:

  • folder copy/initialization
  • image resizing
  • writing data to template pages (using ejs)
  • installing/building components

You use it as a library in custom build scripts:

var Guilder = require('guilder')
// where does the app template live 
var source = __dirname + '/gametemplate'
// where are we building the app 
var dest = __dirname + '/dist/test'
// create a project from the source template and the destination folder 
// everything from here becomes relative 
var project = Guilder(source, dest)
// handle logging 
project.on('log', function(st){
// run through build steps in series 
        // do something custom 
    // install the component in the source folder with autoReset = true 
    // install the component in the source folder with autoReset = true 
    // this will create the destination folder with autoRemove = true 
    // copy files using globs 
    project.copy('css/**', function(path){
        // you can alter the copy path here 
        return path
    // resize images 
    project.resizeImages('img/*.png', '590x600', function(path){
        // you can alter the copy path here 
        return path
    // write data - this can be .html pages or any other text file 
    project.write('config.json', JSON.stringify({}))
], function(error){


var project = Guilder(source)

Create a new project from a source template


Proxy to async.parallel


Proxy to async.series

Guilder.copy(srcFolder, glob, destFolder)

Static version of copy where you can pass the source and destination folders explicitly


Ensure the destination folder exists - autoRemove will delete if it exists


Install the component in the source folder - autoReset will remove the components folder before component install


Build the component in the source folder - autoReset will remove the build folder before component build

project.copy(srcGlob, [processPath])

Copy each file matching the srcGlob into the dest folder

processPath is a map function that lets you change the target location of each file

project.manualCopy(srcFolder, srcGlob, destFolder, [processPath])

The same as copy but you get to specific the source and destination folders

project.resizeImages(srcGlob, size, [processPath])

Resize images matching the glob into the destination location

Size is an object with width and height properties or a string of the format [width]x[height]

processPath is an optional function that can remap the destination path for the image

project.resizeImages('img/**', '100x100', function(path){
        return 'otherfolder/car.jpg'
        return path

project.write(path, data)

Write a 'utf8' encoded text file to the file at dest/[path]

This is useful for writing templates and other data

project.template(src, target, data)

Render an ejs template loaded from src (in the source folder) and using data, then write the output to target (in the destination folder)


project.on('log', function(string){})

The logs are emitted to be handled in a custom way