I
I
Ilya Agarkov2015-03-24 09:48:12
Node.js
Ilya Agarkov, 2015-03-24 09:48:12

How to include all style files from a folder in webpack?

Maybe someone knows a ready-made solution for connecting all files in a folder without specifying each file separately?
For example, the entire application is divided into components. Each component is in a separate folder. The folder also describes the styles for this component (that is, the folder can contain not only styles). I would like to connect all the styles from the folder with one command. Something like this:
require('./*.css')

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
enixpp, 2015-06-06
@enixpp

https://github.com/webpack/docs/wiki/context
require.context('./', false, /\.css$/ )

1
123 123, 2015-03-24
@roman01la

IMHO, it's better to do it by hand, especially in the case of CSS. What if the module that does this for you connects the modules in the wrong order, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question