Workaround a bug where the comment location is off for scss (#1799)
Workarounds https://github.com/postcss/postcss-scss/issues/63master
parent
6cecb83cdf
commit
6a9e053221
|
@ -2533,9 +2533,19 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
return concat([printNodeSequence(path, options, print), hardline]);
|
||||
}
|
||||
case "css-comment": {
|
||||
return n.raws.content
|
||||
? n.raws.content
|
||||
: options.originalText.slice(util.locStart(n), util.locEnd(n));
|
||||
if (n.raws.content) {
|
||||
return n.raws.content;
|
||||
}
|
||||
const text = options.originalText.slice(util.locStart(n), util.locEnd(n));
|
||||
// Workaround a bug where the location is off.
|
||||
// https://github.com/postcss/postcss-scss/issues/63
|
||||
if (text.indexOf(n.text) === -1) {
|
||||
if (n.raws.inline) {
|
||||
return concat(['// ', n.text]);
|
||||
}
|
||||
return concat(['/* ', n.text, ' */']);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case "css-rule": {
|
||||
return concat([
|
||||
|
|
|
@ -17,6 +17,34 @@ exports[`block.css 1`] = `
|
|||
|
||||
`;
|
||||
|
||||
exports[`bug.css 1`] = `
|
||||
@font-face {
|
||||
src: url(if(
|
||||
$bootstrap-sass-asset-helper,
|
||||
twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'),
|
||||
'#{$icon-font-path}#{$icon-font-name}.eot'
|
||||
));
|
||||
}
|
||||
|
||||
// Catchall baseclass
|
||||
/* Catchall baseclass */
|
||||
.glyphicon {
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@font-face {
|
||||
src: url(if(
|
||||
$bootstrap-sass-asset-helper,
|
||||
twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'),
|
||||
'#{$icon-font-path}#{$icon-font-name}.eot'
|
||||
));
|
||||
}
|
||||
// Catchall baseclass
|
||||
/* Catchall baseclass */
|
||||
.glyphicon {
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`places.css 1`] = `
|
||||
div {
|
||||
// a
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
@font-face {
|
||||
src: url(if(
|
||||
$bootstrap-sass-asset-helper,
|
||||
twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'),
|
||||
'#{$icon-font-path}#{$icon-font-name}.eot'
|
||||
));
|
||||
}
|
||||
|
||||
// Catchall baseclass
|
||||
/* Catchall baseclass */
|
||||
.glyphicon {
|
||||
}
|
Loading…
Reference in New Issue