{"id":13447828,"url":"https://github.com/pyrsmk/toast","last_synced_at":"2025-10-22T16:18:00.839Z","repository":{"id":1798959,"uuid":"2722943","full_name":"pyrsmk/toast","owner":"pyrsmk","description":"A modern JS/CSS asset loader, written in TypeScript.","archived":false,"fork":false,"pushed_at":"2020-07-31T16:34:45.000Z","size":2087,"stargazers_count":117,"open_issues_count":2,"forks_count":13,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-10-21T21:38:44.794Z","etag":null,"topics":["assets-management","css","js","loader"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dailymotion/vast-client-js","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyrsmk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"pyrsmk","ko_fi":"pyrsmk"}},"created_at":"2011-11-06T23:07:22.000Z","updated_at":"2025-10-04T13:56:58.000Z","dependencies_parsed_at":"2022-08-25T16:50:13.880Z","dependency_job_id":null,"html_url":"https://github.com/pyrsmk/toast","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/pyrsmk/toast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrsmk%2Ftoast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrsmk%2Ftoast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrsmk%2Ftoast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrsmk%2Ftoast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyrsmk","download_url":"https://codeload.github.com/pyrsmk/toast/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrsmk%2Ftoast/sbom","scorecard":{"id":751907,"data":{"date":"2025-08-11","repo":{"name":"github.com/pyrsmk/toast","commit":"82ccb9dabf0f689533f1ebadab46b9675b7be64f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/13 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 19 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T20:37:11.272Z","repository_id":1798959,"created_at":"2025-08-22T20:37:11.273Z","updated_at":"2025-08-22T20:37:11.273Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280403407,"owners_count":26324822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assets-management","css","js","loader"],"created_at":"2024-07-31T05:01:27.928Z","updated_at":"2025-10-22T16:18:00.807Z","avatar_url":"https://github.com/pyrsmk.png","language":"JavaScript","funding_links":["https://patreon.com/pyrsmk","https://ko-fi.com/pyrsmk"],"categories":["JavaScript"],"sub_categories":[],"readme":"# Toast v3\n\nToast is a promise-based JS/CSS loader for the browser. It aims to optimize web site performance by loading your assets asynchronoulsy.\n\n## Quick note on IE9/10 support\n\nSupport has been dropped for these browsers since Mocha/Sinon (which is used to run our tests) does not support them anymore. Since it would take some time to migrate the tests, that IE9/10 is not supported anymore by Microsoft, and that its market share have dropped under 1%, we took the decision to stop our support too.\n\nFor the time being, Toast `3.0.2` will work with IE9/10. Since the code shouldn't evolve too much, you should be safe in the far future until Toast reaches a breaking change.\n\n# Compatibility list\n\nToast is tested against:\n\n- Chrome 83 (older version should be good too)\n- Firefox 76 (older version should be good too)\n- Edge 83 (older version should be good too)\n- Safari 11-13\n- IE11\n- Android 4.4-10\n- iOS 10-13\n\n## Set up\n\nThe preferred way to load toast in your application is to install it via NPM (or [Yarn](https://yarnpkg.com/)), and import it directly in your codebase (it has a very small footprint, and the sooner it's loaded the better).\n\n```sh\nnpm install toast-loader\n```\n\nYou have several options to load it in your code depending on your application environment:\n\n- by inlining it in a `\u003cscript\u003e` tag\n- with `const { toast } = require('toast-loader')`\n- with `import { toast } from 'toast-loader'`\n\nYou can also load it from the usual `\u003cscript\u003e` tag in your `\u003chead\u003e`, but I advise you to use a [CDN](https://www.jsdelivr.com/) instead of loading it from your own server:\n\n```html\n\u003chead\u003e\n    \u003cscript src=\"https://cdn.jsdelivr.net/npm/toast-loader@3.0.4\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n```\n\nBe sure to use the latest version of Toast and keep a fixed version in production environment (to avoid breaking changes).\n\n## The API\n\n```js\ntoast.css(url: string): Promise\ntoast.js(url: string): Promise\ntoast.all(urls: string[]): Promise\n```\n\n## Examples\n\n```js\nif (dark_mode === true) {\n    toast.css('styles/dark.css')\n} else {\n    toast.css('styles/light.css')\n}\n```\n\n```js\nconst handleErrors = error =\u003e {\n    console.log(error)\n}\n\ntoast.js('http://some.cdn.com/jquery.js')\n    .then(() =\u003e {\n        toast.js('http://some.cdn.com/jquery-myplugin.js')\n            .then(() =\u003e $('.someClass').myPlugin())\n            .catch(handleErrors)\n        })\n    })\n    .catch(handleErrors)\n```\n\n```js\nawait toast.all([\n    'assets/css/styles1.css',\n    'assets/js/script1.js',\n    'assets/js/script2.js',\n    'assets/css/styles2.css',\n    'assets/js/script3.js',\n])\nconsole.log('Everything has been loaded, yay!')\n```\n\n`toast.all` relies on automatic extension detection. If your URL does not contain a file extension you'll need to use `Promise.all` instead and do some extra work:\n\n```js\nawait Promise.all([\n    toast.css('assets/css/styles1'),\n    toast.js('assets/js/script1'),\n    toast.js('assets/js/script2'),\n    toast.css('assets/css/styles2'),\n    toast.js('assets/js/script3'),\n])\nconsole.log('Everything has been loaded, yay!')\n```\n\n## Browser compatibility\n\n- IE10 support (and prior) has been removed since it's not supported by Microsoft anymore and their market share have dropped under 1%\n- Toast is using built-in promises, so if you need to support I11, you must add the [promise-polyfill](https://github.com/taylorhakes/promise-polyfill) library before loading toast: here's the compatibility table for the [Promise feature](https://www.caniuse.com/#feat=promises)\n- for your information, IE11 and Edge never trigger `error` event on CSS loading if something goes wrong; keep this in mind when you're using `catch` promise block\n- if you want to learn more about `SCRIPT`/`LINK` node feature support details, you can take a look at this [compatibility table](https://pie.gd/test/script-link-events/)\n\n## Development\n\nInstall the dependencies with:\n\n```sh\nnpm install\n```\n\nAnd build the lib with:\n\n```sh\nnpm run build\n```\n\nLook at the scripts in `package.json` file for more details.\n\n## Testing\n\nTests are written with [Mocha](https://mochajs.org/) and [Sinon](https://sinonjs.org/), and can be run with:\n\n```sh\nnpm run test\n```\n\nIt should open your default browser (under a Gnome desktop). If not, just drag and drop the `tests/index.html` in your preferred browser.\n\n---\n\nThese tests are just for local debugging when in development phase but they need to pass the Karma tests. [Karma](https://karma-runner.github.io/latest/index.html) is a tool to execute unit tests on remote browsers with Selenium/Appium. To be able to run them, you'll need an account on [BrowserStack](https://www.browserstack.com/). It's the only service that have a free plan for open-source projects.\n\nWhen your account is ready, you must prepare your environment by setting global variables in a file that is loaded when your console initializes, like `.bashrc`, `.zshrc` or `.profile`:\n\n- go to the [Automate page](https://automate.browserstack.com/dashboard/v2)\n- display your `ACCESS KEY` (it's accessible on the right of the search bar)\n- set your env variables like so:\n    ```sh\n    export BROWSERSTACK_USERNAME=\"\u003cyour_username\u003e\"\n    export BROWSERSTACK_ACCESS_KEY=\"\u003cyour_access_key\u003e\"\n    ```\n\nThen, run the karma tests with:\n\n```sh\nnpm run karma:all\n```\n\nThe results will be displayed in the console and on the Automate page of your account.\n\nIf you want to only run tests on a specific browser you can use one of the following commands:\n\n```sh\nnpm run karma:chrome\nnpm run karma:firefox\nnpm run karma:safari13\nnpm run karma:safari12\nnpm run karma:safari11\nnpm run karma:edge\nnpm run karma:ie11\nnpm run karma:android10\nnpm run karma:android9\nnpm run karma:android8\nnpm run karma:android7\nnpm run karma:android6\nnpm run karma:android5\nnpm run karma:android44\nnpm run karma:ios13\nnpm run karma:ios12\nnpm run karma:ios11\nnpm run karma:ios10\n```\n\nNote: I don't know why but the tests can be unstable in some VMs when running all Karma tests in parallel; don't hesitate to re-run tests on a specific VM to verify.\n\n## License\n\n[MIT](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrsmk%2Ftoast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyrsmk%2Ftoast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrsmk%2Ftoast/lists"}