0

I want to mix HTML and SCSS/Sass in one file. Is there a way to make PhpStorm to respect both languages?

Something like this:

<html>
<h1>a Header</h1>
<p>some text</p>
<style lang="scss">
h1 {
 color: red;
 span {
   color: green;
  }
}
</style>
</html>

Is there a way to make PhpStorm to format such a thing correct?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
mxsteini
  • 11
  • 1
  • 1
    Sure: https://stackoverflow.com/a/36331588/783119 (works since 2017.1 version) -- use ` – LazyOne Aug 17 '22 at 21:36

1 Answers1

0

Using

<style type="text/scss">
        h1 {
            color: red;
        span {
            color: green;
        }
        }
</style>

should do the thing; but note that SCSS will not run in a browser without first being compiled to CSS.

lena
  • 90,154
  • 11
  • 145
  • 150
  • A great solution - works like a ccharme. Thanks for the hint. my scss is extracted and processed by posthtml. – mxsteini Aug 19 '22 at 12:07