Home  >  Article  >  Web Front-end  >  Configuration method of using sass in vue project

Configuration method of using sass in vue project

亚连
亚连Original
2018-05-25 16:44:401454browse

This article mainly introduces the configuration method of using sass in the vue project. Friends who need it can refer to it

1. Create a new project based on the webpack template

$ vue init webpack myvue

2. In the current directory, install dependencies

$ cd myvue
$ npm install

3. Install sass dependency packages

npm install --save-dev sass-loader
//sass-loader依赖于node-sass
npm install --save-dev node-sass

4. Add configuration in the rules of webpack.base.conf.js in the build folder

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

As shown below:

5. Modify the style tag in APP.vue