简体   繁体   English

如何将 css/scss 文件从 node_module 导入一个类(用于更改组件的主题)

[英]How Import css/scss file into a class from node_module ( for change theme of component )

I use syncfision components.我使用同步化组件。 I want this component to use the Dark theme when the app-dark class is on the div.当 app-dark 类在 div 上时,我希望这个组件使用 Dark 主题。 I need to import two themes but they should be used in each case like the following:我需要导入两个主题,但应在每种情况下使用它们,如下所示:

@import '../../../../node_modules/@syncfusion/ej2-angular-grids/styles/material.css';

.app-dark {
  @import '../../../../node_modules/@syncfusion/ej2-angular-grids/styles/material-dark.css';
}

this is the my imports and .scss file .这是我的进口和 .scss 文件。

This is the wrong styling and the compiler will get it wrong.这是错误的样式,编译器会出错。 But how can I do what I want to do?但是我怎么能做我想做的事呢?

We tried to import “.scss”file as you mentioned in earlier update but we are facing some compilation issues.我们尝试导入您在之前更新中提到的“.scss”文件,但我们面临一些编译问题。 The inner level imports are not included in the destination css file and we raised a query to “gulp-sass” team.内部级别的导入不包含在目标 css 文件中,我们向“gulp-sass”团队提出了查询。 We will validate and update further details after we get reply from “gulp-sass” team.我们将在收到“gulp-sass”团队的回复后验证并更新更多细节。

We have shared a reported bug link for your reference below,我们在下面分享了一个报告的错误链接供您参考,

https://github.com/dlmanning/gulp-sass/issues/757 https://github.com/dlmanning/gulp-sass/issues/757

Meanwhile, we suggest you to refer below kb to change theme dynamically,同时,我们建议您参考以下kb动态更改主题,

KB- https://www.syncfusion.com/kb/10868/dynamic-theme-change KB- https://www.syncfusion.com/kb/10868/dynamic-theme-change

Sample - https://github.com/SyncfusionExamples/EJ2-Angular-Dynamic-theme-Switch示例 - https://github.com/SyncfusionExamples/EJ2-Angular-Dynamic-theme-Switch

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

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