Polymer / pwa-starter-kit

Starter templates for building full-featured Progressive Web Apps from web components.
https://pwa-starter-kit.polymer-project.org
2.36k stars 431 forks source link

Best practices for static resources? #358

Closed mercmobily closed 4 years ago

mercmobily commented 5 years ago

Hi there,

Thanks for the awesome work.

I would like to add a "static" directory where to place random files (say file.txt). Adding "static/**/*" will do half the trick. However, once built, the file itself will only be reachable via es6-bundled/static/file.txt when linked directly. Using relative links will obviously work. However, this won't work when an element needs to link to a resource in static/ AND that very same element can be used in different parts of the application at different depth in terms of URL.

Two possible solutions:

1) Add a symlink from the build directory (which will be the root of the served pages, no matter what) to the actual directory

2) Have the app consistently prefix any "absolute" URLs with document.baseURI

Is there a better way to do do this? I am sure I must be missing something... What's the recommended best practice for it?

stale[bot] commented 4 years ago

This project is no longer under development and will be transitioning to a read-only repo. Thank you for your contributions.