mirror of
https://github.com/KevinMidboe/inline-html.git
synced 2025-10-29 17:40:29 +00:00
Updated README.
This commit is contained in:
44
README.md
44
README.md
@@ -16,42 +16,52 @@ Inline local assets referenced in an HTML document.
|
||||
|
||||
This:
|
||||
|
||||
var inlineHtml = require('inline-html');
|
||||
inlineHtml('path/to/file.html').then(function (html) {
|
||||
```js
|
||||
var inlineHtml = require('inline-html');
|
||||
inlineHtml('path/to/file.html').then(function (html) {
|
||||
...
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Turns this:
|
||||
|
||||
<link rel="stylesheet/less" href="main.less"/>
|
||||
<style>
|
||||
```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"/>
|
||||
</style>
|
||||
<div style="background-image: url('path/to/file');"></div>
|
||||
<img src="path/to/file"/>
|
||||
```
|
||||
|
||||
Into this:
|
||||
|
||||
<style>
|
||||
```html
|
||||
<style>
|
||||
@font-face { src: url('data:...'); }
|
||||
div { background-image: url('data:...'); }
|
||||
</style>
|
||||
<style>
|
||||
</style>
|
||||
<style>
|
||||
div { background-image: url('data:...'); }
|
||||
</style>
|
||||
<div style="background-image: url('data:...');"></div>
|
||||
<img src="data:..."/>
|
||||
</style>
|
||||
<div style="background-image: url('data:...');"></div>
|
||||
<img src="data:..."/>
|
||||
```
|
||||
|
||||
Where:
|
||||
|
||||
- `main.less`
|
||||
|
||||
@import (inline) 'main.css';
|
||||
div { background-image: url('path/to/file'); }
|
||||
```css
|
||||
@import (inline) 'main.css';
|
||||
div { background-image: url('path/to/file'); }
|
||||
```
|
||||
|
||||
- `main.css`
|
||||
|
||||
@font-face { src: url('path/to/file'); }
|
||||
```css
|
||||
@font-face { src: url('path/to/file'); }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
|
||||
Reference in New Issue
Block a user