Skip to content
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

Files referenced from CSS packaged improperly #614

Open
pangyuehung opened this issue Sep 18, 2023 · 1 comment
Open

Files referenced from CSS packaged improperly #614

pangyuehung opened this issue Sep 18, 2023 · 1 comment

Comments

@pangyuehung
Copy link

pangyuehung commented Sep 18, 2023

Is this a bug report?

Referencing any files from CSS (even placed in /public) appear to get packaged and then referenced incorrectly (using /static/css as the root).

I have tried using: /public/main.css as well as just /src/main.css and referencing an image in /public or even in /src but both end up improperly referenced. So having a line like:

  background-image: url("/images/example.jpg");

No matter what was used as the image path, %PUBLIC_URL%/images/example.jpg or ./images/example.jpg, etc. the actual referenced file ends up being something like /static/css/static/media/example.907d6572.jpg because the path is relative to the CSS file so static/media/example.907d6572.jpg gets appended to /static/css where the stylesheet lives.

Environment

Using with Gitlab CI to deploy to Gitlab Pages

  1. node -v: v18.17.
  2. npm -v: 10.1.0
  3. yarn --version (if you use Yarn): n/a
  4. npm ls create-elm-app -g (if you haven’t ejected): create-elm-app@5.22.0

Then, specify:

  1. Operating system: Fedora Silverblue 39
  2. Browser and version (if relevant): n/a
@pangyuehung
Copy link
Author

pangyuehung commented Sep 19, 2023

PUBLIC_URL='/' fixed this, but I would have assumed that was the default. Any idea why this is needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant