From d7ac29d846d8c170d8df1d27dfa4d33e26b7aff6 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Wed, 8 Jan 2020 18:20:16 +0000 Subject: [PATCH] fix: respect map.annotation string --- index.js | 2 +- lib/getMapfile.js | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index e54247d..0e4bef8 100644 --- a/index.js +++ b/index.js @@ -222,7 +222,7 @@ function css(css, file) { tasks.push(fs.outputFile(options.to, result.css)) if (result.map) { - const mapfile = getMapfile(options.to) + const mapfile = getMapfile(options) tasks.push(fs.outputFile(mapfile, result.map)) } } else process.stdout.write(result.css, 'utf8') diff --git a/lib/getMapfile.js b/lib/getMapfile.js index b9dd441..a0f665a 100644 --- a/lib/getMapfile.js +++ b/lib/getMapfile.js @@ -1,4 +1,8 @@ 'use strict' -module.exports = function getMapfile(p) { - return `${p}.map` +const path = require('path') +module.exports = function getMapfile(options) { + if (options.map && typeof options.map.annotation === 'string') { + return path.join(path.dirname(options.to), options.map.annotation) + } + return `${options.to}.map` }