How to use SASS / SCSS with latest vue-cli starter project?(如何在最新的 vue-cli 启动项目中使用 SASS/SCSS?)
问题描述
我需要在我的项目中使用 SASS 或 SCSS.
I need to use SASS or SCSS in my project.
我使用 vue-cli 制作了一个最新版本的入门项目.
I used the vue-cli to make the latest version of a starter project.
有人在使用 webpack 的最新入门项目中成功地使 sass/scss 工作吗?
Anyone had any success in making sass/scss work in the newest starter project with webpack?
推荐答案
你安装必要的依赖项
you install the necessary dependencies
npm install -D node-sass sass-loader
对于全局样式,只需将文件导入main.js
:
for global styles, simply import the file into main.js
:
import './styles/my-styles.scss'
在 .vue
文件中,将 lang 添加到 <style>
元素.
in .vue
files, add the lang to the <style>
element.
<style lang="scss">
如果使用 webstorm:
If using webstorm:
<style lang="scss" rel="stylesheet/scss">
这篇关于如何在最新的 vue-cli 启动项目中使用 SASS/SCSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在最新的 vue-cli 启动项目中使用 SASS/SCSS?


- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01