Skip to content

Commit d128580

Browse files
committed
Support arrays in skipInterpolation
Closes #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.
1 parent c117a83 commit d128580

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/generate.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var Handlebars = require('handlebars')
33
var async = require('async')
44
var render = require('consolidate').handlebars.render
55
var path = require('path')
6-
var match = require('minimatch')
6+
var multimatch = require('multimatch')
77
var getOptions = require('./options')
88
var ask = require('./ask')
99
var filter = require('./filter')
@@ -91,12 +91,16 @@ function filterFiles (filters) {
9191
*/
9292

9393
function renderTemplateFiles (skipInterpolation) {
94+
skipInterpolation = typeof skipInterpolation === 'string'
95+
? [skipInterpolation]
96+
: skipInterpolation
9497
return function (files, metalsmith, done) {
9598
var keys = Object.keys(files)
9699
var metalsmithMetadata = metalsmith.metadata()
100+
skipInterpolation
97101
async.each(keys, function (file, next) {
98102
// skipping files with skipInterpolation option
99-
if (skipInterpolation && match(file, skipInterpolation, { dot: true })) {
103+
if (skipInterpolation && multimatch([file], skipInterpolation, { dot: true }).length) {
100104
return next()
101105
}
102106
var str = files[file].contents.toString()

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"inquirer": "^0.12.0",
4040
"metalsmith": "^2.1.0",
4141
"minimatch": "^3.0.0",
42+
"multimatch": "^2.1.0",
4243
"ora": "^0.2.1",
4344
"read-metadata": "^1.0.0",
4445
"request": "^2.67.0",

0 commit comments

Comments
 (0)