1: Installation dependencies
npm install sass-loader node-sass --save-dev
2: Modify style in html
<style lang="sass"> /* write sass here */ </style>
3: Use normal sass syntax
//But there will be an error<style lang="sass"> $highlight-color: #F90; $highlight-border: 1px solid $highlight-color; .selected { border: $highlight-border } // Solution 1 Remember that there must be two spaces in front of the zodiac<style lang="sass"> $highlight-color: #F90 $highlight-border: 1px solid $highlight-color .selected border: $highlight-border </style> // Solution 2 sass is modified to scss<style lang="scss"> $highlight-color: #F90; $highlight-border: 1px solid $highlight-color; .selected { border: $highlight-border } </style> // Official solution You need to configure the option of vue-loader{ 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"> } } }
Link:/zh-cn/configurations/
4: Quoting the sass/scss file
@import "./common/scss/mixin";
Summarize
The above is the method of using sass in vue cli webpack introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!