简体   繁体   English

Angular 中的两个主题。 SCSS中的变量问题

[英]Two themes in Angular. Problem with variable in SCSS

I try to realise two theme in Angular 10 by this flow .我尝试通过这个流程在 Angular 10 中实现两个主题。 It works only with css.它仅适用于 css。 I use SCSS in my project.我在我的项目中使用 SCSS。 How can I modify this example to use scss?如何修改此示例以使用 scss? Sorry that I don't have any code here.抱歉,我这里没有任何代码。 Code you can find it in link.您可以在链接中找到它的代码。 Thanks for help!感谢帮助!

You need to specify you are using SCSS on your project. 您需要指定您在项目中使用 SCSS。

You can manually change your angular.json file like so:您可以像这样手动更改 angular.json 文件:

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

And then change your files from CSS to SCSS, including the main styles.css referenced in the angular.json. And then change your files from CSS to SCSS, including the main styles.css referenced in the angular.json.

Change the app.component.css file to app.component.scss and in app.component.ts change the styleUrls to app.component.scssapp.component.css文件更改为app.component.scss并在 app.component.ts 中将styleUrls更改为app.component.scss

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM