Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/panosoft/html-inlinify
Inline local assets referenced in an HTML document.
https://github.com/panosoft/html-inlinify
Last synced: about 2 months ago
JSON representation
Inline local assets referenced in an HTML document.
- Host: GitHub
- URL: https://github.com/panosoft/html-inlinify
- Owner: panosoft
- Created: 2015-07-23T15:46:11.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-11T14:25:07.000Z (about 7 years ago)
- Last Synced: 2024-11-06T18:52:58.602Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# html-inlinify
Embed local assets in an HTML document with browserify.
[![npm version](https://img.shields.io/npm/v/html-inlinify.svg)](https://www.npmjs.com/package/html-inlinify)
[![npm license](https://img.shields.io/npm/l/html-inlinify.svg)](https://www.npmjs.com/package/html-inlinify)
[![Travis](https://img.shields.io/travis/panosoft/html-inlinify.svg)](https://travis-ci.org/panosoft/html-inlinify)
[![David](https://img.shields.io/david/panosoft/html-inlinify.svg)](https://david-dm.org/panosoft/html-inlinify)
[![npm downloads](https://img.shields.io/npm/dm/html-inlinify.svg)](https://www.npmjs.com/package/html-inlinify)## Installation
```sh
npm install html-inlinify
```## Usage
This browserify transform statically evaluates [inline-html](https://github.com/panosoft/inline-html) expressions in order to embed local assets referenced in an HTML document and bundle the results.
Assuming we have the following `index.js`:
```js
var inlineHtml = require('inline-html');inlineHtml('./index.html').then(function (html) {
// ...
});
```We can use browserify with the addition of this transform:
```sh
browserify -t html-inlinify index.js > bundle.js
```To create the following `bundle.js`:
```js
Promise.resolve('... html string with assets embedded ...').then(function (html) {
// ...
});
```