基于下面的示例,我将electron-webpack与我的角应用程序结合使用:
https://github.com/kendraio/angular-electron-webpack-example
几乎每一个示例,我都可以找到导入样式,这种方式打破了对样式的视图封装。
导入样式的标准角度方式是通过组件styleUrls:
@Component({
selector: 'app-component',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],我对此的看法(以及我是如何因为缺乏更好的方法而这么做的),
import "./app.component.scss";
@Component({
selector: 'app-component',
templateUrl: './app.component.html',
encapsulation: ViewEncapsulation.None
})我尝试过各种装载机的配置,但都没有效果。有没有人有他们的webpack.renderer.additions.js的一个例子,允许以他们想要的方式导入角度样式?
注意:除了src/renderer/app/components/**/*.scss的组件样式之外,我还有一些全局styles at src/renderer/styles/*.scss
发布于 2020-07-12 14:26:25
恐怕这不可能。其原因是角将组件类名追加到styleUrls中的所有样式。
第三方库无法知道组件类名。
https://stackoverflow.com/questions/62861264
复制相似问题