Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Support public prefix on copy

Open
#173 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
tooling, web-dev

Research direction

Start in src/type/copy.js at the linked asset-copying logic and compare its current relative URL calculation with the Remix directory layout in the issue. Determine how a publicPrefix option should affect generated asset URLs while leaving the processed CSS destination unchanged. Done means the option is clearly specified and the copy behavior produces the requested public paths.

Written by the indexing model from the issue text.

Description

I want to use postcss-url in a Remix project. The general setup is described in their docs with a directory layout that looks like this:

styles/
  app.css <-- the source file
app/
  styles/
    app.css <-- where postcss puts the processed file
  root.tsx <-- contains import "./styles/app.css", Remix will copy it to /public/build
/public
  build/
    _assets/
      app-${hash}.css <-- this is where Remix copies the imported file

In order to also hash the assets within the stylesheet, I'd like to place them right next to the source CSS and let postcss-url copy them to /build/assets while the processed CSS should still go to /app/styles/app.css so that Remix can pick it up.

Since Remix doesn't know anything about the assets and postcss does not know that Remix will finally move the processed file to /public/build/_assets/app-${hash}.css the URLs in the generated stylesheet don't match as they would point to url("../../public/assets/...").

I would suggest adding an option to specify a publicPrefix that could be set to /assets in this case. If specified, copy.js would not use path.relative(targetDir, newAssetPath) but normalize(path.join(publicPrefix, assetRelativePath))instead.

Please let me know if this sounds like a good idea to you and if you'd accept a PR for this feature.

Dominant language
JavaScript
Stars
383
Forks
58
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from postcss/postcss-url

All issues in postcss/postcss-url

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.