Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.

Commit 3aab2eb

Browse files
committed
Ignore parsing errors
1 parent 2faf1f2 commit 3aab2eb

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/index.js

+15-11
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,21 @@ module.exports = options => ({
1111
code(input, filepath) {
1212
const absolutePath = path.resolve(process.cwd(), filepath)
1313
sourceMapsCorrections[absolutePath] = {}
14-
const { extractedCSS, sourceMap } = parse(
15-
input,
16-
absolutePath,
17-
Object.assign({}, DEFAULT_OPTIONS, options)
18-
)
19-
// Save source location, merging existing corrections with current corrections
20-
sourceMapsCorrections[absolutePath] = Object.assign(
21-
sourceMapsCorrections[absolutePath],
22-
sourceMap
23-
)
24-
return extractedCSS
14+
try {
15+
const { extractedCSS, sourceMap } = parse(
16+
input,
17+
absolutePath,
18+
Object.assign({}, DEFAULT_OPTIONS, options)
19+
)
20+
// Save source location, merging existing corrections with current corrections
21+
sourceMapsCorrections[absolutePath] = Object.assign(
22+
sourceMapsCorrections[absolutePath],
23+
sourceMap
24+
)
25+
return extractedCSS
26+
} catch (e) {
27+
return "";
28+
}
2529
},
2630
// Fix sourcemaps
2731
result(stylelintResult, filepath) {

0 commit comments

Comments
 (0)