本文介绍了如何使用 angular cli 为 angular 组件样式启用 SCSS 内联模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

Angular v12 提供了对 @Component 装饰器 styles 字段中内联 SCSS 的支持

要在现有应用程序中启用,请在以下部分中将 "inlineStyleLanguage": "scss" 添加到 angular.json

  • architect.build.options
  • architect.test.options

对于 scss 是所选样式的新 Angular CLI 项目,inlineStyleLanguage 配置将默认为 scss

At Codelyzer test file I saw SCSS beeing used in a styles inline template. Is it possible to enable it with Angular CLI?

My SCSS setup is working when using styleUrls but not for direct styles component decorator property.

Update:

I am using Angular CLI 1.0.0 with Angular 4.0.1

This is the error in shown in the WebStorm IDE

解决方案

Support for inline SCSS in @Component decorator styles field is available from Angular v12

To enable in existing applications add "inlineStyleLanguage": "scss" to angular.json in the following sections

  • architect.build.options
  • architect.test.options

For a new Angular CLI project where scss is the selected style the inlineStyleLanguage configuration will default to scss

这篇关于如何使用 angular cli 为 angular 组件样式启用 SCSS 内联模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 03:47