Skip to content

Commit

Permalink
Support arrays in skipInterpolation
Browse files Browse the repository at this point in the history
Closes vuejs#281
Use multimatch instead of match for this purpose.
The minimatch dependency has not been removed because it's still used in
lib/filter.js. Filters should directly use multimatch. Once this
happens, the dependency to minimatch can be removed.
  • Loading branch information
posva committed Jan 1, 2017
1 parent c117a83 commit d128580
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var Handlebars = require('handlebars')
var async = require('async')
var render = require('consolidate').handlebars.render
var path = require('path')
var match = require('minimatch')
var multimatch = require('multimatch')
var getOptions = require('./options')
var ask = require('./ask')
var filter = require('./filter')
Expand Down Expand Up @@ -91,12 +91,16 @@ function filterFiles (filters) {
*/

function renderTemplateFiles (skipInterpolation) {
skipInterpolation = typeof skipInterpolation === 'string'
? [skipInterpolation]
: skipInterpolation
return function (files, metalsmith, done) {
var keys = Object.keys(files)
var metalsmithMetadata = metalsmith.metadata()
skipInterpolation
async.each(keys, function (file, next) {
// skipping files with skipInterpolation option
if (skipInterpolation && match(file, skipInterpolation, { dot: true })) {
if (skipInterpolation && multimatch([file], skipInterpolation, { dot: true }).length) {
return next()
}
var str = files[file].contents.toString()
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"inquirer": "^0.12.0",
"metalsmith": "^2.1.0",
"minimatch": "^3.0.0",
"multimatch": "^2.1.0",
"ora": "^0.2.1",
"read-metadata": "^1.0.0",
"request": "^2.67.0",
Expand Down

0 comments on commit d128580

Please sign in to comment.