Conventions and API for creating scaffolds that can by used by any build system or generator.


Conventions and API for creating scaffolds that can by used by any build system or generator.


Install with npm

$ npm i scaffold --save


Create a reusable scaffold from one or more templates or source files:

var Scaffold = require('scaffold');
var scaffold = new Scaffold('foo', {
  // `~` tildes expand to the user's home directory 
  options: {cwd: '~/scaffolds'},
  src: ['**/component*'],
  dest: 'local/src/'

Returns a normalized configuration object that can easily be used by any build system or generator. The config object returned from the above example would look something like this:

  options: {
    cwd: '~/scaffolds'
  files: [{
    name: 'foo'
    options: {cwd: '/Users/jonschlinkert/scaffolds'},
    src: ['/Users/jonschlinkert/scaffolds/scripts/component.js',
    dest: 'local/src/',

(Table of contents generated by verb)

Create an instance of scaffold:

var Scaffold = require('scaffold');
var foo = new Scaffold('foo', {
  // config/options here   

Scaffold uses expand-target and expand-files as dependencies. Visit those projects for the full range of available features and options:

There are many different ways to create scaffolds, the possibilities are endless. The following are just a few random examples of what a scaffold could be, but don't be limited by my imagination!

Blog post

Create a scaffold for adding blog posts to a project:

var post = new Scaffold('post', {
  options: {cwd: 'scaffolds'},
  src: 'content/', 
  dest: 'src/posts/'

UI components

Create a scaffold for adding UI components to a project:

var component = new Scaffold('component', {
  options: {cwd: 'scaffolds'},
  files: [
    {src: 'templates/component.hbs', dest: 'src/templates/'},
    {src: 'scripts/component.js', dest: 'src/scripts/'},
    {src: 'styles/component.css', dest: 'src/styles/'},


Create a scaffold for dotfiles to use when initializing new projects:

var dotfiles = new Scaffold('dotfiles', {
  // glob pattern for dotfiles 
  src: ['templates/.*'],
  options: {
    // filter out `.DS_Store` files 
    filterfunction (fp) {
      return !/\.DS_Store/.test(fp);


Create a new Scaffold with the given name and config.


  • name {String}: The name of the scaffold.
  • config {Object}: The scaffold's configuration object.


var component = new Scaffold('component', {
  src: ['~/templates/*.js']

Here is a quick reference comparing the difference between boilerplates, scaffolds and templates.

| type | description | | template | Resuable file, code or content which contains "placeholder" values that will eventually be replaced with real values by a rendering (template) engine | | scaffold | Consist of one or more templates or source files and serve as a "temporary support structure" that may be used at init, or throughout the duration of a project. | | boilerplate | Boilerplates consist of all of the necessary files required to initialize a complete project. |

  • assemble: Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… more | homepage
  • boilerplate: Tools and conventions for authoring and publishing boilerplates that can be generated by any build… more | homepage
  • template: Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… more | homepage

As of September 12, 2015:

Statements   : 100% (29/29)
Branches     : 100% (18/18)
Functions    : 100% (3/3)
Lines        : 100% (28/28)

Install dev dependencies:

$ npm i -d && gulp

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Jon Schlinkert

Copyright © 2015 Jon Schlinkert Released under the MIT license.

This file was generated by verb-cli on September 12, 2015.