【问题标题】:Two themes in Angular. Problem with variable in SCSSAngular 中的两个主题。 SCSS中的变量问题
【发布时间】:2021-03-25 13:26:37
【问题描述】:

我尝试通过 flow 在 Angular 10 中实现两个主题。它仅适用于 css。我在我的项目中使用 SCSS。如何修改此示例以使用 scss?抱歉,我这里没有任何代码。您可以在链接中找到它的代码。感谢您的帮助!

【问题讨论】:

  • 您在使用 SCSS 时遇到了哪些具体问题? CSS 是有效的 SCSS。

标签: css angular variables sass frontend


【解决方案1】:

You need to specify you are using SCSS on your project.

您可以像这样手动更改 angular.json 文件:

"schematics": {
    "@schematics/angular:component": {
        "style": "scss"
    }
},

然后将您的文件从 CSS 更改为 SCSS,包括 angular.json 中引用的主要 styles.css。

【讨论】:

  • 它将如何决定我的问题?我的问题是 SCSS 中的变量。我在项目的 4 中使用 SCSS。我需要使用 SCSS 中的变量自定义此示例。因为css中没有这样的变量。
【解决方案2】:

app.component.css 文件更改为app.component.scss 并在app.component.ts 中将styleUrls 更改为app.component.scss

【讨论】:

  • 它将如何决定我的问题?我的问题是 SCSS 中的变量。我在我的项目中的 SCSS 中使用 SCSS。我需要在 SCSS 中使用变量自定义 thix 示例。因为css中没有这样的变量。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-01-08
  • 2020-06-11
  • 1970-01-01
  • 2016-08-20
  • 2017-08-21
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多