# browserify-cdnjs

> Browserify transform to require libraries from jsDelivr.

Latest version **0.1.6** (published 2015-06-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install browserify-cdnjs
pnpm add browserify-cdnjs
yarn add browserify-cdnjs
bun add browserify-cdnjs
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2015-06-21 |
| First published | 2015-04-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Denes Pal |
| Maintainers | dsdenes |
| Keywords | browserify-transform, browserify, transform, cdn, jsdelivr |

## Links

- npm: https://www.npmjs.com/package/browserify-cdnjs
- Repository: https://github.com/dsdenes/browserify-cdnjs
- Homepage: https://github.com/dsdenes/browserify-cdnjs#readme
- Issues: https://github.com/dsdenes/browserify-cdnjs/issues
- npm.io page: https://npm.io/package/browserify-cdnjs

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) ^2.1.3
- [download](https://npm.io/package/download.md) ^4.1.2
- [browserify-transform-tools](https://npm.io/package/browserify-transform-tools.md) ^1.3.3

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.1.6 (latest) — 2015-06-21
- 0.1.4 — 2015-05-20
- 0.1.3 — 2015-04-28
- 0.1.1 — 2015-04-28

## README

# Browserify-cdn
Browserify tranform to use require() loading resources from jsDelivr.

# Usage
```javascript
require('jquery.cdn');

// Transforms to:

require('.cdncache/jquery/main.js');
```
1. Recognizes if the required file name contains a **.cdn extension**.
2. Check if the required library is **already downloaded**.
  1. Transforms the required file name to the **relative path** of the downloaded library.
3. If isn't downloaded, checks if the required library **exists on jsdelivr.com.**
  1. Downloads the latest mainfile of the library into the **.cdncache directory** via this url: ```https://cdn.jsdelivr.net/<library>/latest/mainfile```
  2. Transforms the required file name to the **relative path** of the downloaded library.
  
# Install

```bash
npm install browserify-cdnjs
```

# Usage in your build script
```javascript
// gulpfile.js

var cdnjs = require('browserify-cdnjs');

browserify('index.js')
  .transform(cdnjs)
  .bundle();
```

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