【发布时间】:2019-03-02 14:26:22
【问题描述】:
我使用 --style=sass 创建了一个新的 cli 项目,然后在 src/sass/styles.scss 中定义了一些变量(没有创建部分变量),所以它们应该是全局定义的,对吗? ,所以当我尝试在 home.component.scss 中使用它们时,我收到了这个错误https://imgur.com/a/IckJL14
然后我添加了一个黑色边框,以确保正常的 css 正常工作并且确实有效,问题出在 sass 上, 这是 angular.json
"styles": [
"src/sass/styles.scss",
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"./node_modules/malihu-custom-scrollbar-
plugin/jquery.mCustomScrollbar.css",
"./node_modules/animate.css/animate.min.css",
编辑:然后我创建了一个部分 _variables.scss 并在 component.scss 我写了 @import '~sass/variables';在将它们导入到 styles.scss 中之后,就像 @import './variables';根据此链接的指南:https://scotch.io/tutorials/using-sass-with-the-angular-cli 还是不行。
【问题讨论】:
标签: sass angular6 angular-cli-v6