Skip to content

Commit

Permalink
Update: Use file.dirname when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Jun 17, 2017
1 parent 338eae2 commit 956e5a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function loadSourceMap(file, state, callback) {
if (state.map) {
state.map = state.map.toObject();
// sources in map are relative to the source file
state.path = path.dirname(file.path);
state.path = file.dirname;
state.content = convert.removeComments(state.content);
// remove source map comment from source
file.contents = new Buffer(state.content, 'utf8');
Expand All @@ -45,7 +45,7 @@ function loadSourceMap(file, state, callback) {

var mapFile;
if (mapComment) {
mapFile = path.resolve(path.dirname(file.path), mapComment[1] || mapComment[2]);
mapFile = path.resolve(file.dirname, mapComment[1] || mapComment[2]);
state.content = convert.removeMapFileComments(state.content);
// remove source map comment from source
file.contents = new Buffer(state.content, 'utf8');
Expand Down Expand Up @@ -260,7 +260,7 @@ function contentIncluded(file, state, callback) {
content: state.sourceMap,
});

var sourceMapPathRelative = path.relative(path.dirname(file.path), sourceMapPath);
var sourceMapPathRelative = path.relative(file.dirname, sourceMapPath);

if (!isRemoteSource(sourceMapPathRelative)) {
comment = commentFormatter(file.extname, normalizePath(sourceMapPathRelative));
Expand Down

0 comments on commit 956e5a3

Please sign in to comment.