🚀 DAY 1 OF LAUNCH WEEK: Reachability for Ruby Now in Beta.Learn more →
Socket
Book a DemoInstallSign in
Socket

posthtml-inline-favicon

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posthtml-inline-favicon

PostHTML plugin to inline favicons

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

posthtml-inline-favicon

NPM Deps Build Coverage

posthtml-inline-favicon is a PostHTML plugin to inline favicons.

Before:

<head>
  <link rel="shortcut icon" href="favicon.ico" />
</head>

After:

<head>
  <link rel="icon" type="image/png" href="data:image/png;base64,..." />
</head>

Install

yarn add -D posthtml-inline-favicon
# OR
npm i posthtml-inline-favicon

Usage

const fs = require('fs');
const posthtml = require('posthtml');
const { inlineFavicon } = require('posthtml-inline-favicon');

const html = fs.readFileSync('./index.html');

posthtml()
  .use(inlineFavicon())
  .process(html)
  .then(result => fs.writeFileSync('./after.html', result.html));

Options

By default, the plugin assumes that the file to process is in the same directory as the posthtml script. If not, specify the relative path to the html file in the options:

const fs = require('fs');
const posthtml = require('posthtml');
const { inlineFavicon } = require('posthtml-inline-favicon');

const html = fs.readFileSync('./public/index.html');

posthtml()
  .use(inlineFavicon({ path: 'public' }))
  .process(html)
  .then(result => fs.writeFileSync('./after.html', result.html));

Example

Contributing

See the PostHTML Guidelines.

Changelog

License

MIT

Keywords

posthtml

FAQs

Package last updated on 20 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts