pug-multiple-basedirs-plugin

0.1.5 • Public • Published

pug-multiple-basedirs-plugin

A pug plugin allowing basedir option to be configured as an array. The resolver will attempt to resolve the basedirs in order.

Inspired by https://github.com/pugjs/pug/issues/2499#issuecomment-241927949

Implementation

var MultipleBasedirsPlugin = require("pug-multiple-basedirs-plugin");
 
pug.compileFile(sourceFile, {
  plugins: [
    MultipleBasedirsPlugin({
      paths: ['/templates', '/bower_components']
    })
  ]
});

Now with a file structure of

/bower_components/my-template/foo
/bower_components/my-other-template/baz
/templates/my-template/foo

The following statements will both resolve to /templates/my-template/foo

extends /my-template/foo
include /my-template/foo

While

include /my-other-template/baz

will resolve to /bower_components/my-other-template/baz

Note that this only affects absolute paths (paths with a leading slash).

Readme

Keywords

Package Sidebar

Install

npm i pug-multiple-basedirs-plugin

Weekly Downloads

978

Version

0.1.5

License

ISC

Unpacked Size

2.9 kB

Total Files

3

Last publish

Collaborators

  • grygabrielphon