P
P
pegas2018-12-15 21:12:00
Sass
pegas, 2018-12-15 21:12:00

How to import scss into .vue component?

Unable to import file in .vue component . Installed everything needed - npm install -D sass-loader node-sass .
Inside the style section , the scss syntax works fine, but if I want to import it, I get an error.

<style lang="scss">
  import 'style.scss'
</style>

Here are my rules in webpack
rules: [
      {
        test: /\.vue$/,
        loader: 'vue-loader'
      },
      {
        test: /\.css$/,
        use: [
          'vue-style-loader',
          'css-loader',
        ]
      },
      {
        test: /\.scss$/,
        use: [
          'vue-style-loader',
          'css-loader',
          'sass-loader'
        ]
      }
    ]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2018-12-15
@1PeGaS

so inside you need to write imports like in css

<style lang="scss">
  @import 'style.scss'
</style>

or
<style src="./style.scss" lang="scss"></style>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question