diff --git a/lib/configwriter.js b/lib/configwriter.js index 987b151..731446b 100644 --- a/lib/configwriter.js +++ b/lib/configwriter.js @@ -145,7 +145,10 @@ ConfigWriter.prototype.process = function (file, config) { lfile = new File(file); } + var relativePath = self.root ? '' : lfile.dir.split('/').splice(1).join('/'); + lfile.blocks.forEach(function (block) { + // FIXME: support several searchPath... var context = { inDir: self.root || lfile.searchPath[0], @@ -165,7 +168,9 @@ ConfigWriter.prototype.process = function (file, config) { // If this is the last writer of the pipe, we need to output // in the destination directory - context.outDir = last ? self.dest : path.join(self.staging, writer.name); + context.outDir = last ? path.join(self.dest, relativePath) : + path.join(self.staging, writer.name, relativePath); + context.last = last; config[writer.name] = config[writer.name] || {}; config[writer.name].generated = config[writer.name].generated || {}; diff --git a/test/fixtures/relative_path_parent.html b/test/fixtures/relative_path_parent.html new file mode 100644 index 0000000..8be1605 --- /dev/null +++ b/test/fixtures/relative_path_parent.html @@ -0,0 +1,12 @@ + +
+ + + + + + + + + +