mirror of
https://github.com/KevinMidboe/inline-html.git
synced 2025-12-08 20:29:06 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dff5f1160b | ||
|
|
abb3dd95a7 | ||
|
|
8f27f9d04f | ||
|
|
76ff6ca703 |
14
README.md
14
README.md
@@ -1,11 +1,11 @@
|
||||
# inline-html
|
||||
|
||||
Embed local assets in an HTML document.
|
||||
Inline local assets referenced in an HTML document.
|
||||
|
||||
[]()
|
||||
[]()
|
||||
[]()
|
||||
[]()
|
||||
[]()
|
||||
[]()
|
||||
|
||||
## Installation
|
||||
@@ -16,22 +16,27 @@ Embed local assets in an HTML document.
|
||||
|
||||
This:
|
||||
|
||||
```js
|
||||
var inlineHtml = require('inline-html');
|
||||
inlineHtml('path/to/file.html').then(function (html) {
|
||||
...
|
||||
});
|
||||
```
|
||||
|
||||
Turns this:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet/less" href="main.less"/>
|
||||
<style>
|
||||
div { background-image: url('path/to/file'); }
|
||||
</style>
|
||||
<div style="background-image: url('path/to/file');"></div>
|
||||
<img src="path/to/file"/>
|
||||
```
|
||||
|
||||
Into this:
|
||||
|
||||
```html
|
||||
<style>
|
||||
@font-face { src: url('data:...'); }
|
||||
div { background-image: url('data:...'); }
|
||||
@@ -41,17 +46,22 @@ Into this:
|
||||
</style>
|
||||
<div style="background-image: url('data:...');"></div>
|
||||
<img src="data:..."/>
|
||||
```
|
||||
|
||||
Where:
|
||||
|
||||
- `main.less`
|
||||
|
||||
```css
|
||||
@import (inline) 'main.css';
|
||||
div { background-image: url('path/to/file'); }
|
||||
```
|
||||
|
||||
- `main.css`
|
||||
|
||||
```css
|
||||
@font-face { src: url('path/to/file'); }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "inline-html",
|
||||
"version": "0.1.4",
|
||||
"description": "Embed local assets in an HTML document.",
|
||||
"version": "0.1.5",
|
||||
"description": "Inline local assets referenced in an HTML document.",
|
||||
"repository": "panosoft/inline-html",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user