https://github.com/lstrojny/dyal
Dynamic asset loader to control loading of CSS and JS files
https://github.com/lstrojny/dyal
Last synced: 3 months ago
JSON representation
Dynamic asset loader to control loading of CSS and JS files
- Host: GitHub
- URL: https://github.com/lstrojny/dyal
- Owner: lstrojny
- Created: 2018-04-03T10:22:32.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-31T13:01:45.000Z (over 6 years ago)
- Last Synced: 2024-10-10T14:28:34.547Z (8 months ago)
- Language: TypeScript
- Size: 62.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DYAL
## JS / CSS asset loader to enable retry and fallback use cases### Use cases
* If the CDN fails, download an asset from the original domain
* If [SRI](https://www.w3.org/TR/SRI/) validation fails, fall back to a different resource
* If an asset fails to load, retry### Design goals
* **Compact**: halfway small so to be directly included in each page: it’s 1.6K right now and it’s likely gonna shrink.
This is why it does not have (and should not have) any external runtime dependencies
* **Familiar**: Sane defaults to not offer too many surprises
* **Recognizable**: offers a Promise based API for asynchronicity**Full disclosure:** `DYAL` is mostly an excuse for me to learn some TypeScript but maybe it’s also useful.
## Tooling
* `yarn install` will the relevant development dependencies
* `yarn build` will output `dist/loader.js` which is meant to be used
* `yarn testbed` will build a development version and run a webserver on `localhost:8081` to serve a testbed (open the
developer console to see if things work)
* `yarn fmt` will format all the code
* `yarn dev` will run rollup in watch mode