diff options
Diffstat (limited to 'node_modules/clean-css/lib/reader/rebase-local-map.js')
-rw-r--r-- | node_modules/clean-css/lib/reader/rebase-local-map.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/node_modules/clean-css/lib/reader/rebase-local-map.js b/node_modules/clean-css/lib/reader/rebase-local-map.js new file mode 100644 index 000000000..aec8d2324 --- /dev/null +++ b/node_modules/clean-css/lib/reader/rebase-local-map.js @@ -0,0 +1,15 @@ +var path = require('path'); + +function rebaseLocalMap(sourceMap, sourceUri, rebaseTo) { + var currentPath = path.resolve(''); + var absoluteUri = path.resolve(currentPath, sourceUri); + var absoluteUriDirectory = path.dirname(absoluteUri); + + sourceMap.sources = sourceMap.sources.map(function(source) { + return path.relative(rebaseTo, path.resolve(absoluteUriDirectory, source)); + }); + + return sourceMap; +} + +module.exports = rebaseLocalMap; |