Say I have the following structure
/node_modules
/src
/components
/component1
/style
/style.less
Now I want to import some LESS file from node_modules/some-module/style.less
; I'd have to do something like @import '../../../../node_modules/some-module/style.less
Is there no short hand notation so that the path is relative to project folder? Something like @import ~/node_modules/some-module/style.less
?
You can achieve this by installing less-loader and add it into webpack.
How to do it: https://www.npmjs.com/package/less-loader#webpack-resolver
Example:
@import "~font-awesome/css/font-awesome.min.css";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With