Updated README.

This commit is contained in:
Alexandre Gigliotti
2015-08-10 08:55:40 -07:00
parent 8f27f9d04f
commit abb3dd95a7

View File

@@ -16,42 +16,52 @@ Inline local assets referenced 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