I am trying to import less files automatically using webpack less-loader, but glob expressions do not work in root.less file.
In detail, I replace the gulp builder webpack, and I can use this template:
@import 'widgets/**/*.less';
to import fewer files into gulp automatically (check this link for the glob expression ). However, this pattern is not valid in webpack and less-loader seems to not support them.
I tried using the require.context method of webpack, but I cannot configure the import of orders or files. I need to require fewer files in a logical sequence because I use global variables (mixins, color codes, etc.). Therefore, this option is also unavailable.
import '../components/variables.less';
importAll(require.context('../components/', true, /\.less$/));
So it seems I need to import each file manually, which is very painful. So I wonder if there is a way to import files automatically?
Thanks for the help!
source
share