https://github.com/fb55/inline
inline all images, stylesheets and scripts of a webpage
https://github.com/fb55/inline
Last synced: 7 months ago
JSON representation
inline all images, stylesheets and scripts of a webpage
- Host: GitHub
- URL: https://github.com/fb55/inline
- Owner: fb55
- License: bsd-2-clause
- Created: 2012-11-10T15:19:36.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2024-04-08T13:25:26.000Z (about 2 years ago)
- Last Synced: 2025-02-11T01:47:09.884Z (over 1 year ago)
- Language: JavaScript
- Size: 309 KB
- Stars: 15
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# inline
inline all images, stylesheets and scripts of a webpage.
This is a (partial) port of [`remy/node-inliner`](https://github.com/remy/inliner) to my [`htmlparser2`](http://npm.im/htmlparser) module.
#### installation
npm i inline
#### usage
```js
const Inline = require("inline");
const minreq = require("minreq");
minreq.get("http://feedic.com/").pipe(
new Inline(
"http://feedic.com/",
{
// Default options:
images: true, // Inline images
scripts: true, // Inline scripts
stylesheets: true, // Inline stylesheets
},
(err, data) => {
if (err) throw err;
require("fs").writeFileSync("index.html", data);
}
)
);
```
#### todo
`inline` currently doesn't minify inlined scripts & stylesheets, and also doesn't support gzip compressed sources. At least support for gzip compression is planned.
---
License: BSD-like