Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Not possible to import external stylesheets #10

Closed
papermana opened this issue Aug 8, 2017 · 7 comments · Fixed by #18
Closed

Not possible to import external stylesheets #10

papermana opened this issue Aug 8, 2017 · 7 comments · Fixed by #18

Comments

@papermana
Copy link

Is this a bug report?

No.

Currently, there is no way, as far as I know, to add an external stylesheet to the app. Notably, importing stylesheets in JS will not work because of CSS Modules. This makes it impossible to use certain 3rd party components.

One solution is to add a separate config for CSS/SCSS files imported from node_modules. I made a proof of concept commit here that seems to work when I make those changes locally. I'm not sure if I'm not omitting anything in the config, though. Also, I haven't made any changes to the production config. I can make a proper PR if the changes here look good to others.

@virzen
Copy link

virzen commented Aug 9, 2017

Seems fine to me. Would love to get it released soon. 😄

@papermana
Copy link
Author

Made a PR, hopefully it's all right

@papermana
Copy link
Author

papermana commented Aug 9, 2017

Actually, one more thing to look at is external in-CSS imports. For instance, react-dates has a section here with code like

@import '~react-dates/css/variables.scss';

This should work as well but I'm not sure if my proposed solution provides that.

@paweljedrzejczyk
Copy link

I believe this should work:

:global {
  @import '~react-dates/css/variables.scss';
}

@virzen
Copy link

virzen commented Aug 10, 2017

Should it work out of the box? With the following code

:global {
  @import '~normalize.css';
  @import '~bootstrap/dist/css/bootstrap.css';
}

normalize.css gets included, but bootstrap's import results in

./src/global-styles.scss
Module not found: Can't resolve '~bootstrap/dist/css/bootstrap.css' in '/Users/wiktor/Workspace/spideo-front/src'

Bootstrap is installed of course.

@virzen
Copy link

virzen commented Aug 10, 2017

I can see that it can't handle nested directories. @import '~bootstrap'; seems to get imported properly (of course it results in syntax error, because it's javascript, not css).

@virzen
Copy link

virzen commented Aug 10, 2017

Ok, the problem was .css at the end. Everything works fine. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants