Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing a css npm package in css file

I made a NPM package which contains a CSS file which I have to include in my main CSS file. In a normal html CSS website I have to write @import url("./node_modules/web-creative-fonts/index.css") but what I want to do is that we just have to write @import "web-creative-fonts" . I studied a bit about it and found that we can make a webpack.config.js to do it ,but I am not able to figure out how.

Can anyone help?

like image 237
Bhuvnesh Sharma Avatar asked Jun 02 '26 19:06

Bhuvnesh Sharma


1 Answers

I think you can use something like css-loader. It's a Webpack plugin that makes importing CSS from NPM a breeze.

like image 52
Adityo Pratomo Avatar answered Jun 06 '26 07:06

Adityo Pratomo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!