G
G
Greg Popov2017-11-17 00:42:06
Sass
Greg Popov, 2017-11-17 00:42:06

Vue.js app, how to build less/sass?

Hello. I'm starting to understand Vue.js, I'm stuck on connecting the processing of .scss / .less files. The project is a template pig installed through the console.
The moment with the assembly is not entirely clear: do I write everything in .sass / .less according to the classics, then I include the minified file, or do I write my own styles in each .vue component, and do one common with imports?
The project has webpack out of the box (3.6.0).
From the off documentation, I tried to connect the handler in this way:

{
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
          loaders: {
            scss: 'vue-style-loader!css-loader!sass-loader', // <style lang="scss">
            sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax' // <style lang="sass">
          }
        }
      }

Effect - 0.
Explain pliz, what's the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Velko, 2017-11-17
@Gregpopov

Try like this:

{
  test: /\.vue$/,
  loader: 'vue-loader',
},
{
  test: /\.scss$/,
  loaders: [ "style-loader", "css-loader", "sass-loader" ]
},

And then importing the styles into the component:
<style lang="scss">
  @import "./main";
</style>

My advice, use vue-cli if you haven't already.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question