{"id":18185083,"url":"https://github.com/jaandrle/dynamic_resources","last_synced_at":"2026-04-24T16:04:55.104Z","repository":{"id":55648051,"uuid":"319975476","full_name":"jaandrle/dynamic_resources","owner":"jaandrle","description":"Yet another lightweight promise-based scripts/stylesheets loader (no support for IE).","archived":false,"fork":false,"pushed_at":"2020-12-16T14:00:07.000Z","size":33,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-01T18:13:19.673Z","etag":null,"topics":["async","css","dynamic-loading","javascript","promise"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaandrle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-09T14:06:59.000Z","updated_at":"2020-12-16T14:00:10.000Z","dependencies_parsed_at":"2022-08-15T05:30:57.494Z","dependency_job_id":null,"html_url":"https://github.com/jaandrle/dynamic_resources","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaandrle%2Fdynamic_resources","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaandrle%2Fdynamic_resources/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaandrle%2Fdynamic_resources/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaandrle%2Fdynamic_resources/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaandrle","download_url":"https://codeload.github.com/jaandrle/dynamic_resources/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247654965,"owners_count":20974101,"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","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":["async","css","dynamic-loading","javascript","promise"],"created_at":"2024-11-02T22:05:54.740Z","updated_at":"2026-04-24T16:04:55.052Z","avatar_url":"https://github.com/jaandrle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynamic_resources\nYet another lightweight promise-based scripts/stylesheets loader (no support for IE).\n\nThis library provide `Promise` way of loading resources such as *JavaScripts* and *CSSs*.\n\n## Content\n- [Vanilla JavaScript](#Vanilla-JavaScript)\n- [Another libraries](#Another-libraries)\n- [This library](#This-library)\n- [Usage](#Usage)\n- [Documentation and examples](#Documentation-and-examples)\n\nFirstly, it is possible you don’t need special library…\n\n## Vanilla JavaScript\nFor loading scripts, you can use [Dynamic Imports | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports) – use `import`:\n```JavaScript\nimport(\"module_path\")\n.then(successFunction)\n.catch(errorFunction);\n```\nOr `\u003cscript\u003e`:\n```JavaScript\nconst _import= src=\u003e new Promise(function(onload,onerror){\n    return document.body.appendChild(Object.assign(\n        document.createElement(\"script\"),\n        { src, onload, onerror }\n    ));\n});\n_import(\"script url\")\n.then(successFunction)\n.catch(errorFunction);\n```\n\n## Another libraries\nFor more sofistikated usage, you can use librares:\n- [MiguelCastillo/load-js: Promise based script loader for the browser using script tags](https://github.com/MiguelCastillo/load-js)\n- [codeKonami/load-external-scripts: dynamically load external scripts, and report when is completed (Promise)](https://github.com/codeKonami/load-external-scripts)\n- [wanghongrui/loadScript: Load JS or CSS with Promise](https://github.com/wanghongrui/loadScript)\n- [stormid/storm-load: Lightweight promise-based script loader](https://github.com/stormid/storm-load)\n- [tomek-f/simple-load-script: Very simple promise based script loader and JSONP](https://github.com/tomek-f/simple-load-script)\n\n## This library\nBenefit of this library is providing more functionalities than [Vanilla JavaScript](#Vanilla-JavaScript) and is focused on post-IE browsers (ligter/cleaner than [Another librares](#Another-libraries)).\n\nAlso, there is no internal implementation for bacth import, because you can use `Promise.all`/`Promise.race`/etc.\n\nFor now(?), there is no support for detecting of duplications – you can implement the right for your needs (eg. using hhml id).\n\nThere are 3 different kind of this library (in folder [./bin](./bin)) such as [JavaScript modules | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) version.\n\n## Usage\nNOTE: The **'_'** is my convetnion for function returning `Promise`.\n\n```JavaScript\nimport { script_ } from \"./bin/dynamic_resources-module.min\";\n// just simple example\nscript_(\"path\")\n.then(/* onsuccess */)\n.catch(/* onerror */);\n// or more komplex\nif(!document.querySelectorAll(\"[data-remote=true]\").length){\n    Promise.all([ \"path1\", \"path2\" ].map(path=\u003e script_(path, { dataset: { remote: true } })))\n    .then(/* onsuccess */)\n    .catch(event=\u003e void(event.target.dataset.remote= false));\n    /* probably better logic needed (eg. something like \"try again\") */\n}\n```\n\n## Documentation and examples\n- [Documentation](./docs/dynamic_resources-namespace.md): [css_](./docs/dynamic_resources-namespace.md#dynamic_resources.css_), [script_](./docs/dynamic_resources-namespace.md#dynamic_resources.script_)\n- [Examples](https://jaandrle.github.io/dynamic_resources/examples.html)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaandrle%2Fdynamic_resources","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaandrle%2Fdynamic_resources","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaandrle%2Fdynamic_resources/lists"}