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 = ; pug;
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).