New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I import a CSS file from node_modules? #3034
Comments
This is driving me crazy |
Check this thread out below. I have not tried this yet but will be doing so soon. https://stackoverflow.com/questions/49518277/import-css-from-node-modules-in-webpack Here is some other info on the help site. https://electron-react-boilerplate.js.org/docs/styling It did not work with ~ but this worked for me in App.tsx file. import '../../node_modules/bootstrap/dist/css/bootstrap.css'; |
Here's an example of integrating tailwind, which requires importing tailwind from node_modules |
This seemed promising but adding CSS loaders to No matter what I do as soon as I add the line |
In your
|
That's not even a CSS stylesheet. |
Have you tried it? It works for Bootstrap |
Yes, and it doesn't work. |
This is a working example of ERB + bootstrap https://github.com/kbrisso/erb-bootstrap-ipc |
Sorry but we are looking for a solution for semantic ui |
I just looked through the errors and it looks like it is a problem with importing fonts. |
@developomp I tried to replicate your issue but I could not install Semantic because of a Gulp issue. What I did is download the current build https://github.com/Semantic-Org/Semantic-UI-CSS/archive/master.zip. I unpacked it in the node_modules folder and then added the dependency to my package file. I wasn't able to use the "~" import but I was able to add this to the App.tsx It built fine but then when I ran it I encountered this error. I found this post I removed the semicolon from min CSS and then I ran it again and it worked. It seems to work this way, let me know if this helps. |
Shame we can't fix the issue here |
Thank you so much @kbrisso for taking a deep look into it. I ended up writing a script for postinstall that replaces double semicolons from |
How do I import a CSS file from node_modules?
I've been trying to solve this problem for one whole day trying every combination under the sun and none of them worked for me.
The only thing that was even remotely close to a solution was adding a stylesheet link to cdn in
index.ejs
but I'd like a solution that works offline too.index.ejs:
Things I've tried (and every combination):
~
in front of the import path../..
)webpack.config.base.ts
:import 'package/path/to/css.css';
@import 'package/path/to/css.css';
to a CSS file and importing itRelated issues:
How to reproduce the issue:
semantic-ui-css
packagesemantic-ui-css/semantic.min.css
The text was updated successfully, but these errors were encountered: