Support public prefix on copy
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
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from postcss/postcss-url
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
postcss/postcss-url#183 · 1 comment · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
postcss/postcss-url#182 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
postcss/postcss-url#181 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
postcss/postcss-url#180 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
postcss/postcss-url#179 ·
All issues in postcss/postcss-url
Similar issues
-
Bump Firebase JS SDK (12.19.0 → 13.0.0)Possibly taken @SelaseKay claimed this today. OpenNeeds Attention type: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
invertase/react-native-firebase#9364 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
tchiotludo/akhq#3307 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
DietrichGebert/ponytail#1063 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
zen-browser/desktop#15809 · 1 reaction ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 90/100