如何在“react app 2"中设置 SCSS 文件(ViewEncapsulated 方式),如 Angular 组件特定的 SCSS? [英] How can I setup SCSS files (ViewEncapsulated way) in 'react app 2' like Angular component specific SCSS?

查看:30
本文介绍了如何在“react app 2"中设置 SCSS 文件(ViewEncapsulated 方式),如 Angular 组件特定的 SCSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了react app 2"和 node-sass.它与 SCSS 一起工作得很好.但我只想知道如何创建像 Angular 这样的组件特定的 SCSS(永远不会与其他组件 SCSS 发生冲突)

I installed 'react app 2' as well as node-sass. It's working fine with SCSS. But I just want to know how can I create component specific SCSS like Angular (that will never be a conflict with other components SCSS)

Angular 自动为 ViewEncapsulation 添加一个属性见下例

Angular automatically add an attribute for ViewEncapsulation see below example

在angular中,有一个选项

In angular, there is an option for

encapsulation: ViewEncapsulation.None(用于禁用该组件的CSS封装)在此处输入链接描述

encapsulation: ViewEncapsulation.None (Use to disable CSS Encapsulation for this component) enter link description here

推荐答案

我知道这个问题很老,但没有答案,所以我想分享一下 这篇文章.Alsomst 可以解决这个问题,除了它似乎不支持 ::ng-deep

I know the question is old, but it has no answer, thus I want to share this article. Alsomst does the trick, with the exception that it seems to does not have support for something like ::ng-deep

这篇关于如何在“react app 2"中设置 SCSS 文件(ViewEncapsulated 方式),如 Angular 组件特定的 SCSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆