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

Latest version **0.1.5** (published 2019-06-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install pug-multiple-basedirs-plugin
pnpm add pug-multiple-basedirs-plugin
yarn add pug-multiple-basedirs-plugin
bun add pug-multiple-basedirs-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2019-06-18 |
| First published | 2017-03-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Gryphon Myers |
| Maintainers | grygabrielphon |
| Keywords | pug |

## Links

- npm: https://www.npmjs.com/package/pug-multiple-basedirs-plugin
- Repository: https://github.com/gryphonmyers/pug-multiple-basedirs-plugin
- Homepage: https://github.com/gryphonmyers/pug-multiple-basedirs-plugin#readme
- Issues: https://github.com/gryphonmyers/pug-multiple-basedirs-plugin/issues
- npm.io page: https://npm.io/package/pug-multiple-basedirs-plugin

## Recent versions

- 0.1.5 (latest) — 2019-06-18
- 0.1.3 — 2017-03-28
- 0.1.1 — 2017-03-27

## README

# 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
```javascript
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).

---
_Source: https://npm.io/package/pug-multiple-basedirs-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
