+25
-5
@@ -10,5 +10,5 @@ /*! | ||
| var use = require('use'); | ||
| var util = require('expand-utils'); | ||
| var utils = require('./utils'); | ||
| var util = require('expand-utils'); | ||
| var use = require('use'); | ||
@@ -38,3 +38,3 @@ /** | ||
| this.options = options || {}; | ||
| if (utils.isScaffold(options) || util.isTask(options)) { | ||
| if (Scaffold.isScaffold(options)) { | ||
| this.options = {}; | ||
@@ -47,2 +47,11 @@ this.addTargets(options); | ||
| /** | ||
| * Static method that returns true if the given value appears to | ||
| * be a scaffold configuration object or an instance of `Scaffold`. | ||
| */ | ||
| Scaffold.isScaffold = function(val) { | ||
| return util.isTask(val) || utils.isScaffold(val); | ||
| }; | ||
| /** | ||
| * Add targets to the scaffold, while also normalizing src-dest mappings and | ||
@@ -63,2 +72,3 @@ * expanding glob patterns in each target. | ||
| Scaffold.prototype.addTargets = function(scaffold) { | ||
| util.run(this, 'scaffold', scaffold); | ||
| for (var key in scaffold) { | ||
@@ -74,2 +84,3 @@ if (scaffold.hasOwnProperty(key)) { | ||
| } | ||
| return this; | ||
| }; | ||
@@ -83,5 +94,14 @@ | ||
| * scaffold.addTarget('foo', { | ||
| * src: '*.hbs', | ||
| * dest: 'templates/' | ||
| * src: 'templates/*.hbs', | ||
| * dest: 'site' | ||
| * }); | ||
| * | ||
| * // other configurations are possible | ||
| * scaffold.addTarget('foo', { | ||
| * options: {cwd: 'templates'} | ||
| * files: [ | ||
| * {src: '*.hbs', dest: 'site'}, | ||
| * {src: '*.md', dest: 'site'} | ||
| * ] | ||
| * }); | ||
| * ``` | ||
@@ -88,0 +108,0 @@ * @param {String} `name` |
+1
-1
| { | ||
| "name": "scaffold", | ||
| "description": "Conventions and API for creating declarative configuration objects for project scaffolds - similar in format to a grunt task, but more portable, generic and can be used by any build system or generator - even gulp.", | ||
| "version": "0.2.4", | ||
| "version": "0.2.5", | ||
| "homepage": "https://github.com/jonschlinkert/scaffold", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
+13
-4
@@ -176,3 +176,3 @@ # scaffold [](https://www.npmjs.com/package/scaffold) | ||
| ### [.addTargets](index.js#L59) | ||
| ### [.addTargets](index.js#L68) | ||
@@ -195,3 +195,3 @@ Add targets to the scaffold, while also normalizing src-dest mappings and expanding glob patterns in each target. | ||
| ### [.addTarget](index.js#L88) | ||
| ### [.addTarget](index.js#L108) | ||
@@ -210,5 +210,14 @@ Add a single target to the scaffold, while also normalizing src-dest mappings and expanding glob patterns in the target. | ||
| scaffold.addTarget('foo', { | ||
| src: '*.hbs', | ||
| dest: 'templates/' | ||
| src: 'templates/*.hbs', | ||
| dest: 'site' | ||
| }); | ||
| // other configurations are possible | ||
| scaffold.addTarget('foo', { | ||
| options: {cwd: 'templates'} | ||
| files: [ | ||
| {src: '*.hbs', dest: 'site'}, | ||
| {src: '*.md', dest: 'site'} | ||
| ] | ||
| }); | ||
| ``` | ||
@@ -215,0 +224,0 @@ |
15574
4.47%133
15.65%290
3.2%