Workaround bug with comment ending in */ (#1810)
Reported in the original repo: https://github.com/postcss/postcss-scss/issues/64master
parent
59e4e83355
commit
2ab3d6d6ac
|
@ -2537,13 +2537,14 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
return n.raws.content;
|
||||
}
|
||||
const text = options.originalText.slice(util.locStart(n), util.locEnd(n));
|
||||
const rawText = n.raws.text || n.text;
|
||||
// Workaround a bug where the location is off.
|
||||
// https://github.com/postcss/postcss-scss/issues/63
|
||||
if (text.indexOf(n.text) === -1) {
|
||||
if (text.indexOf(rawText) === -1) {
|
||||
if (n.raws.inline) {
|
||||
return concat(["// ", n.text]);
|
||||
return concat(["// ", rawText]);
|
||||
}
|
||||
return concat(["/* ", n.text, " */"]);
|
||||
return concat(["/* ", rawText, " */"]);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
|
|
@ -82,3 +82,17 @@ exports[`selector.css 1`] = `
|
|||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`trailing_star_slash.css 1`] = `
|
||||
@media (max-width: 1) {}
|
||||
a {
|
||||
// element.style */
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@media (max-width: 1) {
|
||||
}
|
||||
a {
|
||||
// element.style */
|
||||
}
|
||||
|
||||
`;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
@media (max-width: 1) {}
|
||||
a {
|
||||
// element.style */
|
||||
}
|
Loading…
Reference in New Issue