Skip to content
This repository has been archived by the owner on Jun 23, 2021. It is now read-only.
/ metalsmith-relative Public archive

A metalsmith plugin which adds a function to the metadata to calculate relative paths.

Notifications You must be signed in to change notification settings

axa-ch/metalsmith-relative

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

metalsmith-relative

A metalsmith plugin which adds a function to the metadata to calculate relative paths.

This is useful when you can't use absolute paths because you deploy to different context roots.

usage

Add the plugin to your build:

var relative = require('metalsmith-relative');
var opts = {
  methodName: 'relative'
};  // see options for further information

metalsmith.use(relative({ opts }));

Use it within your templates (for example within /foo/bar/baz.jade):

script(src=relative('/js/foobar.js'))

Results in:

<script src="../../js/foobar.js" />

options

methodName: Name of the method which will be injected into the metadata. Defaults to relative

About

A metalsmith plugin which adds a function to the metadata to calculate relative paths.

Resources

Stars

Watchers

Forks

Packages

No packages published