vercel/styled-jsx

Resolve urls inside separate css-files

Open

#598 ouverte le 8 nov. 2019

Voir sur GitHub
 (6 commentaires) (2 réactions) (0 assignés)JavaScript (310 forks)batch import
enhancementhelp wanted

Métriques du dépôt

Stars
 (7 547 stars)
Métriques de merge PR
 (Merge moyen 25j 23h) (1 PR mergée en 30 j)

Description

Do you want to request a feature or report a bug?

Request a feature or request docs addition

Images in url() do not resolve if separate css-files setup is used.

https://github.com/zeit/styled-jsx#styles-in-regular-css-files Here it is documented how to use separate files for styles. However if we do that we can no longer insert images resolved by Webpack.

I tried to use css-loader but then the styles are rendered in such a way that it won't work at all.

Are there any plans or ideas how to handle this properly? Css inside components doesn't seem right but images have to be handled with Webpack. Normally there are some means to parse them out of url(). Without Webpack I can't use image loaders like those that encode images in base64. Without separate files I can't use IDE css helping tools. Something is off.

I ended up rolling my own Webpack loader to handle this but it seems like too much complexity.

Guide contributeur