# inlineresources

> Inlines style sheets, images, fonts and scripts in HTML documents. Works in the browser.

Latest version **1.2.0** (published 2026-01-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install inlineresources
pnpm add inlineresources
yarn add inlineresources
bun add inlineresources
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

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

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2026-01-12 |
| First published | 2014-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 283.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Christoph Burgmer |
| Maintainers | cburgmer |
| Keywords | inline, assets, resources, HTML, JS, CSS, webfonts |

## Links

- npm: https://www.npmjs.com/package/inlineresources
- Repository: https://github.com/cburgmer/inlineresources
- Homepage: https://www.github.com/cburgmer/inlineresources
- Issues: https://github.com/cburgmer/inlineresources/issues
- npm.io page: https://npm.io/package/inlineresources

## Dependencies (2)

- [url](https://npm.io/package/url.md) ~0.11.0
- [css-font-face-src](https://npm.io/package/css-font-face-src.md) ^1.0.0

## 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

- 1.2.0 (latest) — 2026-01-12
- 1.1.0 — 2025-11-06
- 1.0.1 — 2020-10-25
- 1.0.0 — 2018-03-18
- 0.4.0 — 2017-06-04
- 0.3.2 — 2016-10-29
- 0.3.0 — 2016-04-04
- 0.2.0 — 2016-03-09
- 0.1.7 — 2016-02-23
- 0.1.6 — 2015-01-15
- 0.1.1 — 2014-06-06
- 0.1.0 — 2014-04-02

## README

inlineresources
===============

<a href="https://www.npmjs.org/package/inlineresources">
    <img src="https://badge.fury.io/js/inlineresources.svg"
         align="right" alt="NPM version" height="18">
</a>

Inlines style sheets, images, fonts and scripts in HTML documents. Works in the browser.

See the [API](https://github.com/cburgmer/inlineresources/wiki/API).

Install
-------

    $ npm install inlineresources

and require through browserify or webpack.

Alternatively use a standalone bundle via e.g. https://wzrd.in/standalone/inlineresources@latest.

Limitations
-----------

Resources referenced in the document (CSS, images, fonts and JS) can only be loaded if from the [same origin](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript), unless techniques like [CORS](http://enable-cors.org) are used.

Yet to be supported:

* Background images in inline style declarations (`<div style="...">`)
* Media queries defined on link elements (`<link rel="stylesheet" media="..." />`)
* Media queries defined on import rules (`@import url("...") screen and (orientation:landscape);`)
* Future responsive img solution (`<img srcset="...">`)

Similar projects for Node.js
----------------------------

* [jasonbellamy/asset-inliner](https://github.com/jasonbellamy/asset-inliner)
* [cdata/collapsify](https://github.com/cdata/collapsify)
* [EE/grunt-inline-images](https://github.com/EE/grunt-inline-images)
* [popeindustries/inline-source](https://github.com/popeindustries/inline-source)
* [LearnBoost/juice](https://github.com/LearnBoost/juice)
* [fb55/node-inline](https://github.com/fb55/node-inline)
* [callumlocke/resource-embedder](https://github.com/callumlocke/resource-embedder)
* [kevva/rework-inline](https://github.com/kevva/rework-inline)
* [andreypopp/xcss-inline-woff](https://github.com/andreypopp/xcss-inline-woff)
* ... and many more

Development
-----------

For linting, tests and a browser build install Node.js and run

    $ npm install && npm test

Check `./dist/` for the browserified builds.

To test against several browsers while editing, run `grunt testWatch` and point those browsers to `http://localhost:9989/`.

[![Build Status](https://travis-ci.org/cburgmer/inlineresources.svg?branch=master)](https://travis-ci.org/cburgmer/inlineresources)

Where is it used?
-----------------

* [rasterizeHTML.js](https://github.com/cburgmer/rasterizeHTML.js), Renders HTML into the browser's canvas
* ...

Author
------
Christoph Burgmer. Licensed under MIT. Reach out [on Twitter](https://twitter.com/cburgmer).

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