Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

christophercliff/metalsmith-fingerprint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

metalsmith-fingerprint

Build Status

A fingerprint plugin for Metalsmith.

Installation

npm install metalsmith-fingerprint

Usage

var fingerprint = require('metalsmith-fingerprint')

Metalsmith(__dirname)
  .use(fingerprint(options))
  .build()

Options

  • match String|Array<String>

    A pattern to filter source files. Required.

Example

Say you want to fingerprint the file css/index.css:

Metalsmith(__dirname)
  .use(fingerprint({ pattern: 'css/index.css' }))
  .use(template({ engine: 'handlebars' }))
  .build()

The plugin does two things:

  1. create a duplicate of index.css with a fingerprinted filename
  2. create a fingerprint object on the Metalsmith metadata

The fingerprint object is accessible from the Handlebars template:

<link href="{{ fingerprint.[css/index.css] }}" rel="stylesheet" type="text/css" />

And the template renders the fingerprinted filename:

<link href="css/index-724af9dd72a48c18dd570790c2445fb4.css" rel="stylesheet" type="text/css" />

Tests

$ npm test

License

See LICENSE.

About

A fingerprint plugin for Metalsmith

Resources

License

Stars

Watchers

Forks

Packages

No packages published