Skip to content

gryphonmyers/pug-multiple-basedirs-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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 pugjs/pug#2499 (comment)

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).

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published