Skip to content

mitchellst/nunjucks-prepend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

#nunjucks-prepend A prepend() filter for nunjucks, the rich and powerful JS template system from Mozilla.

What's it do?

It builds out URL paths. So for instance, you want to type the location of something in your template, then prefix it with you assets directory and your domain:

<link rel="stylesheet" href="{{ "css/myPage.css" | prepend(site.assetsFolder, site.domain) }}">

You can pass it any number of arguments to prepend to the URL. The first passed argument will show up closest to the value you are filtering.

How do I install it?

Attach it to your nunjucks environment using addFilter.

const nunjucks = require('nunjucks'),
    njPrepend = require('nunjucks-prepend');

var env = new nunjucks.Environment();
env.addFilter('prepend', njPrepend);

Note: ES6 only.

About

Prepend tag for the rich and powerful template engine.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published