mirror of
https://github.com/KevinMidboe/inline-html.git
synced 2025-12-08 20:29:06 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dff5f1160b | ||
|
|
abb3dd95a7 | ||
|
|
8f27f9d04f | ||
|
|
76ff6ca703 | ||
|
|
8e3a9b0390 | ||
|
|
56a6f43657 | ||
|
|
d5c6a6b540 |
57
README.md
57
README.md
@@ -1,8 +1,9 @@
|
|||||||
# inline-html
|
# inline-html
|
||||||
|
|
||||||
Embed local assets in an HTML document.
|
Inline local assets referenced in an HTML document.
|
||||||
|
|
||||||
[]()
|
[]()
|
||||||
|
[]()
|
||||||
[]()
|
[]()
|
||||||
[]()
|
[]()
|
||||||
[]()
|
[]()
|
||||||
@@ -15,42 +16,52 @@ Embed local assets in an HTML document.
|
|||||||
|
|
||||||
This:
|
This:
|
||||||
|
|
||||||
var inlineHtml = require('inline-html');
|
```js
|
||||||
inlineHtml('path/to/file.html').then(function (html) {
|
var inlineHtml = require('inline-html');
|
||||||
...
|
inlineHtml('path/to/file.html').then(function (html) {
|
||||||
});
|
...
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
Turns this:
|
Turns this:
|
||||||
|
|
||||||
<link rel="stylesheet/less" href="main.less" />
|
```html
|
||||||
<style>
|
<link rel="stylesheet/less" href="main.less"/>
|
||||||
div { background-image: url('path/to/file'); }
|
<style>
|
||||||
</style>
|
div { background-image: url('path/to/file'); }
|
||||||
<div style="background-image: url('path/to/file');"></div>
|
</style>
|
||||||
<img src="path/to/file" />
|
<div style="background-image: url('path/to/file');"></div>
|
||||||
|
<img src="path/to/file"/>
|
||||||
|
```
|
||||||
|
|
||||||
Into this:
|
Into this:
|
||||||
|
|
||||||
<style>
|
```html
|
||||||
@font-face { src: url('data:...'); }
|
<style>
|
||||||
div { background-image: url('data:...'); }
|
@font-face { src: url('data:...'); }
|
||||||
</style>
|
div { background-image: url('data:...'); }
|
||||||
<style>
|
</style>
|
||||||
div { background-image: url('data:...'); }
|
<style>
|
||||||
</style>
|
div { background-image: url('data:...'); }
|
||||||
<div style="background-image: url('data:...');"></div>
|
</style>
|
||||||
<img src="data:..." />
|
<div style="background-image: url('data:...');"></div>
|
||||||
|
<img src="data:..."/>
|
||||||
|
```
|
||||||
|
|
||||||
Where:
|
Where:
|
||||||
|
|
||||||
- `main.less`
|
- `main.less`
|
||||||
|
|
||||||
@import (inline) 'main.css';
|
```css
|
||||||
div { background-image: url('path/to/file'); }
|
@import (inline) 'main.css';
|
||||||
|
div { background-image: url('path/to/file'); }
|
||||||
|
```
|
||||||
|
|
||||||
- `main.css`
|
- `main.css`
|
||||||
|
|
||||||
@font-face { src: url('path/to/file'); }
|
```css
|
||||||
|
@font-face { src: url('path/to/file'); }
|
||||||
|
```
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "inline-html",
|
"name": "inline-html",
|
||||||
"version": "0.1.2",
|
"version": "0.1.5",
|
||||||
"description": "Embed local assets in an HTML document.",
|
"description": "Inline local assets referenced in an HTML document.",
|
||||||
"repository": "panosoft/inline-html",
|
"repository": "panosoft/inline-html",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cheerio": "^0.19.0",
|
"cheerio": "^0.19.0",
|
||||||
"co": "^4.6.0",
|
"co": "^4.6.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user