Skip to content

Commit ee57066

Browse files
fiskerprettifier[bot]
andauthored
HTML: Fix format on style[lang="sass"] (#9051)
Co-authored-by: prettifier[bot] <45367598+prettifier[bot]@users.noreply.github.com>
1 parent 073dfd9 commit ee57066

File tree

23 files changed

+393
-5
lines changed

23 files changed

+393
-5
lines changed

changelog_unreleased/TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#### Title ([#XXXX](https://github.com/prettier/prettier/pull/XXXX) by [@user](https://github.com/user))
2626

27-
Optional description if it makes sense.
27+
<!-- Optional description if it makes sense. -->
2828

2929
<!-- prettier-ignore -->
3030
```jsx
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#### Fix format on `style[lang="sass"]` ([#9051](https://github.com/prettier/prettier/pull/9051) by [@fisker](https://github.com/fisker))
2+
3+
<!-- prettier-ignore -->
4+
```jsx
5+
<!-- Input -->
6+
<style lang="sass">
7+
.hero
8+
@include background-centered
9+
</style>
10+
11+
<!-- Prettier stable -->
12+
<style lang="sass">
13+
.hero @include background-centered;
14+
</style>
15+
16+
<!-- Prettier master -->
17+
<style lang="sass">
18+
.hero
19+
@include background-centered
20+
</style>
21+
```

src/language-html/utils.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ function _inferScriptParser(node) {
399399

400400
function inferStyleParser(node) {
401401
const { lang } = node.attrMap;
402-
if (lang === "postcss" || lang === "css") {
402+
if (!lang || lang === "postcss" || lang === "css") {
403403
return "css";
404404
}
405405

@@ -421,13 +421,12 @@ function inferScriptParser(node, options) {
421421
}
422422

423423
if (node.name === "style") {
424-
return inferStyleParser(node) || "css";
424+
return inferStyleParser(node);
425425
}
426426

427427
if (options && isVueNonHtmlBlock(node, options)) {
428428
return (
429429
_inferScriptParser(node) ||
430-
inferStyleParser(node) ||
431430
(!("src" in node.attrMap) && getParserName(node.attrMap.lang, options))
432431
);
433432
}

tests/html/multiparser-css/__snapshots__/jsfmt.spec.js.snap renamed to tests/html/multiparser/css/__snapshots__/jsfmt.spec.js.snap

File renamed without changes.
File renamed without changes.

tests/html/multiparser-js/__snapshots__/jsfmt.spec.js.snap renamed to tests/html/multiparser/js/__snapshots__/jsfmt.spec.js.snap

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)