# load-script-or-css

> Load a script or stylesheet in the browser asynchronously, returning a Promise

Latest version **0.0.3** (published 2020-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install load-script-or-css
pnpm add load-script-or-css
yarn add load-script-or-css
bun add load-script-or-css
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2020-05-27 |
| First published | 2020-05-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 18 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andreas Pizsa |
| Maintainers | andreaspizsa |
| Keywords | load, inject, script, javascript, js, stylesheet, css, async, asynchronously, promise, browser |

## Links

- npm: https://www.npmjs.com/package/load-script-or-css
- Repository: https://github.com/AndreasPizsa/load-script-or-css
- Issues: https://github.com/AndreasPizsa/load-script-or-css/issues
- npm.io page: https://npm.io/package/load-script-or-css

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.3 (latest) — 2020-05-27
- 0.0.0-development — 2020-05-27
- 0.0.2 — 2020-05-27
- 0.0.1 — 2020-05-03

## README

# load-script-or-css

> Load a script or stylesheet in the browser asynchronously, returning a Promise

## Usage
```js
const {loadCss, loadScript} = require('load-script-or-css')

// Load one Stylesheet
await loadCss('http://unpkg.com/bootstrap/dist/css/bootstrap.min.css')

// Load one script
await loadScript('http://unpkg.com/bootstrap/dist/js/bootstrap.min.js')

// load a stylesheet and a script
await Promise.all([
  loadCss('http://unpkg.com/bootstrap/dist/css/bootstrap.min.css'),
  loadScript('http://unpkg.com/bootstrap/dist/js/bootstrap.min.js')
])

// load a stylesheet and a script, but don’t fail if one
await Promise.all([
  loadCss('http://unpkg.com/bootstrap/dist/css/bootstrap.min.css').dontThrow(),
  loadScript('http://unpkg.com/bootstrap/dist/js/bootstrap.min.js').dontThrow()
])
```

---
_Source: https://npm.io/package/load-script-or-css · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
