css assets path is different in npm run start /npm run build
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- css, typescript
- Domain
- build-system, frontend
Research direction
Start with the public reproduction repository and compare npm run start with npm run build served through http-server; consult the linked local-assets documentation for supported asset handling. Verify whether new assets are copied without restarting and whether CSS URLs resolve consistently in both modes. Done means the behavior is corrected or clearly documented for images and fonts.
Written by the indexing model from the issue text.
Description
Stencil version:
@stencil/core@1.12.2<version>
I'm submitting a:
[ ] bug report
[x ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
I've created a component project from scratch with npm init stencil, selecting component in the menu
Inside the my-component folder, I've created an assets folder with an image inside
1.- The project is not detecting the new folder and I'm obliged to stop/start the project to get the new files copied into www/build folder (minor issue imho)
2.- on npm run start to reference an asset in css the path is build/assets/opensource.png
now I run a npm run build and with http-server I serve an index.html, the folder in with the images are now is /www/build/assets/opensource.png,
Expected behavior:
1.- Files automatically copied to www/build folder
2.- Provide a way to use css assets independant of the environment
Steps to reproduce:
I provide a public repo with the example:
https://github.com/biaggi/stencil-poc-css
Related code:
// insert any relevant code here
Other information:
This is the documentation I've found about assets in stenciljs
https://stenciljs.com/docs/local-assets
It's relative to assets in jsx but cannot find information about assets in css, are not supported? any reccomendation?
Another use case is when the component is imported as npm package, the route would be in node_modules...
If the file is an image, I can encode it in base64 encode as a workaround, but If is a font... I dont know what I should do with it.
Best regards
- Dominant language
- TypeScript
- Stars
- 13.1k
- Forks
- 855
- Avg merge
- 4h 7m
- Merged PRs (30d)
- 44
Contributor guide
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 stenciljs/core
-
Stencil v5
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Stencil v5
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Bug: Validated Stencil v5
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Feature: Want this? Upvote it!
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Feature: Want this? Upvote it!
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·