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

Configuration method of using sass in vue project

亚连
Release: 2018-05-25 16:44:40
Original
1759 people have browsed it

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
Copy after login

2. In the current directory, install dependencies

$ cd myvue
$ npm install
Copy after login

3. Install sass dependency packages

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

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

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

As shown below:

5. Modify the style tag in APP.vue

<style lang="scss">
Copy after login

6, and then run the project

$ npm run dev
Copy after login

7. Modify the style of APP.vue, you can see the effect

8. Does the background of the running result turn gray, indicating that you have successfully configured sass

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Ajax realizes intelligent prompt search function

Reverse Ajax quickly mastered in 30 minutes

Configuration of Ajax global loading box (Loading effect)

The above is the detailed content of Configuration method of using sass in vue project. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template