@medley/serve-favicon

0.1.2 • Public • Published

@medley/serve-favicon

npm Version Build Status Coverage Status dependencies Status

Medley plugin for serving the default favicon (/favicon.ico).

Installation

npm install @medley/serve-favicon --save
# or
yarn add @medley/serve-favicon

Usage

const medley = require('@medley/medley');
const path = require('path');

const app = medley();

app.register(require('@medley/serve-favicon'), {
  favicon: path.join(__dirname, 'public', 'favicon.ico')
});

Plugin Options

favicon (required)

Type: string | Buffer

Either a path string pointing to the favicon file or a Buffer containing the favicon file.

// Using a path string
app.register(require('@medley/serve-favicon'), {
  favicon: path.join(__dirname, 'path/to/favicon.ico')
});

// Using a Buffer
app.register(require('@medley/serve-favicon'), {
  favicon: fs.readFileSync('./path/to/favicon.ico')
});

maxAge

Type: number
Default: 31536000 (1 year)

A number in seconds indicating how long browsers should cache the favicon.

app.register(require('@medley/serve-favicon'), {
  favicon: path.join(__dirname, 'public', 'favicon.ico'),
  maxAge: 60 * 60 * 24 * 7 // 1 week
});

Readme

Keywords

Package Sidebar

Install

npm i @medley/serve-favicon

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

5.08 kB

Total Files

4

Last publish

Collaborators

  • nwoltman