Package Exports
- scaffold
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (scaffold) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
scaffold 
Conventions and API for creating scaffolds that can by used by any build system or generator.
Quickstart
Install
Install with npm
$ npm i scaffold --save
Usage
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',
'/Users/jonschlinkert/scaffolds/styles/component.css',
'/Users/jonschlinkert/scaffolds/templates/component.hbs'
],
dest: 'local/src/',
}]
}
Table of contents
- Usage
- Examples
- API
- What is a scaffold?
- Related projects
- Test coverage
- Running tests
- Contributing
- Author
- License
(Table of contents generated by verb)
Usage
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:
Examples
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/post.md',
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/'},
]
});
dotfiles
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
filter: function (fp) {
return !/\.DS_Store/.test(fp);
}
}
});
API
Scaffold
Create a new Scaffold with the given name
and config
.
Params
name
{String}: The name of the scaffold.config
{Object}: The scaffold's configuration object.
Example
var component = new Scaffold('component', {
src: ['~/templates/*.js']
});
What is a scaffold?
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. |
Related projects
- assemble: Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… more | homepage
- boilerplate: Easily create, share and use boilerplates for node.js and web projects. | homepage
- template: Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… more | homepage
Test coverage
As of September 04, 2015:
Statements : 100% (29/29)
Branches : 100% (18/18)
Functions : 100% (3/3)
Lines : 100% (28/28)
Running tests
Install dev dependencies:
$ npm i -d && gulp
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on September 04, 2015.