browserify-versionify
Advanced tools
Comparing version 1.0.3 to 1.0.4
21
index.js
@@ -5,6 +5,5 @@ var findRoot = require('find-root'), | ||
function versionify(options) { | ||
function versionify(file, options) { | ||
options = options || {}; | ||
var filter = options.filter, | ||
@@ -16,12 +15,16 @@ placeholder = options.placeholder || '__VERSION__', | ||
return function(file, opts) { | ||
if (filter && !filter.test(file)) return through2(); | ||
return through2({objectMode: true}, function(chunk, encoding, callback) { | ||
return callback(null, chunk.toString().replace(re, version)) | ||
}); | ||
if (filter && !filter.test(file)) { | ||
return through2(); | ||
} | ||
return through2({objectMode: true}, function(chunk, encoding, callback) { | ||
return callback(null, chunk.toString().replace(re, version)); | ||
}); | ||
} | ||
exports = module.exports = versionify(); | ||
versionify.configure = function(options) { | ||
return function(file) { | ||
return versionify(file, options); | ||
}; | ||
}; | ||
exports.configure = versionify; | ||
module.exports = versionify; |
{ | ||
"name": "browserify-versionify", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Browserify transform to replace placeholder with package version", | ||
@@ -17,5 +17,5 @@ "keywords": [ | ||
"author": { | ||
"name": "Lars Kappert", | ||
"email": "lars@webpro.nl", | ||
"url": "http://webpro.nl" | ||
"name": "Lars Kappert", | ||
"email": "lars@webpro.nl", | ||
"url": "http://webpro.nl" | ||
}, | ||
@@ -22,0 +22,0 @@ "license": "MIT", |
@@ -11,14 +11,14 @@ # browserify-versionify | ||
browserify -t versionify | ||
browserify -t browserify-versionify | ||
From Node.js: | ||
browserify().transform(versionify); | ||
browserify().transform('browserify-versionify'); | ||
// Configure (default values shown) | ||
browserify().transform(versionify.configure({ | ||
browserify().transform('browserify-versionify', { | ||
placeholder: '__VERSION__', | ||
version: pkg.version | ||
})); | ||
}); | ||
You can also provide a `filter` property to whitelist files to apply the transform to (e.g. `filter: /\.js$/`). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1983
23