How to use SASS / SCSS with latest vue-cli starter

2019-01-31 13:37发布

I need to use SASS or SCSS in my project.

I used the vue-cli to make the latest version of a starter project.

Anyone had any success in making sass/scss work in the newest starter project with webpack?

1条回答
The star\"
2楼-- · 2019-01-31 14:11
  1. you install the necessary dependencies

    npm install -D node-sass sass-loader

  2. for global styles, simply import the file into main.js:

    import './styles/my-styles.scss'

  3. in .vue files, add the lang to the <style> element.

    <style lang="scss">

If using webstorm:

<style lang="scss" rel="stylesheet/scss">

查看更多
登录 后发表回答