aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/writer.js
diff options
context:
space:
mode:
Diffstat (limited to 'docs/src/writer.js')
-rw-r--r--docs/src/writer.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/src/writer.js b/docs/src/writer.js
index c9089be0..cdfa12d6 100644
--- a/docs/src/writer.js
+++ b/docs/src/writer.js
@@ -51,13 +51,19 @@ exports.copyTemplate = function(filename) {
* @param transform{function=} transfromation function to be applied before return
*/
exports.copy = function(from, to, transform) {
+ var transformArgs = Array.prototype.slice.call(arguments, 3);
+
from = pathUtils.normalize(from);
to = pathUtils.normalize(to);
// We have to use binary reading, Since some characters are unicode.
return qfs.read(from, 'b').then(function(content) {
if (transform) {
- content = transform.call(null, content.toString(), from, to, transform);
+ // Pass any extra arguments, e.g.
+ // `copy(from, to, transform, extra1, extra2, ...)`
+ // to the transform function
+ transformArgs.unshift(content.toString());
+ content = transform.apply(null, transformArgs);
}
return output(to, content);
});