Skip to content

Commit 175fa0a

Browse files
committed
Update: Use switch statment when generating sourcemaps
1 parent d3db6e0 commit 175fa0a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/helpers.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,15 @@ function fixImportedSourceMap(file, source, options, callback) {
131131
function mapsLoaded(file, source, options, callback) {
132132

133133
if (!source.map && options.identityMap) {
134-
var fileType = path.extname(file.path);
135134
var sourcePath = unixStylePath(file.relative);
136-
// var generator = new SourceMapGenerator({ file: sourcePath });
137-
if (fileType === '.js') {
138-
source.map = generate.js(sourcePath, source.content);
139-
} else if (fileType === '.css') {
140-
source.map = generate.css(sourcePath, source.content);
135+
136+
switch (path.extname(file.path)) {
137+
case '.js':
138+
source.map = generate.js(sourcePath, source.content);
139+
break;
140+
case '.css':
141+
source.map = generate.css(sourcePath, source.content);
142+
break;
141143
}
142144
}
143145

0 commit comments

Comments
 (0)