简体   繁体   English

导入许多scss文件的策略

[英]Strategy to import many scss files

I'm used in Rails to be able to import many sass or scss files in a single import statement. 我在Rails中使用过,能够在一个import语句中导入许多sass或scss文件。 In my application.scss I'd put the following, which would import all files and folders in the folders base/modules/layouts: 在我的application.scss我将输入以下内容,该文件将导入文件夹base / modules / layouts中的所有文件和文件夹:

@import 'base/**/*';
@import 'blocks/**/*';
@import 'layouts/**/*';

Is there any way to accomplish this in a Webpack (2.0) and React (15) context? 有什么方法可以在Webpack(2.0)和React(15)上下文中完成此任务吗?

You can use a preloader like this for webpack https://github.com/Aintaer/import-glob-loader to achieve the behaviour. 您可以为webpack https://github.com/Aintaer/import-glob-loader使用类似这样的预加载器来实现此行为。 Basically this preloader expands your import statement before compiling them. 基本上,此预加载器在编译它们之前会先扩展您的import语句。 Read more on the github page. 在github页面上阅读更多内容。

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

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