-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
40 lines (30 loc) · 1.03 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* @fileoverview Plugin for Eleventy 3. Provides support for Pug templates.
*/
import EleventyPugExtension from './extension.js'
/**
* @typedef {import('@11ty/eleventy/src/UserConfig.js').UserConfig} UserConfig
*/
// TODO: Group Pug-only options under `pugOptions`, and
// add `eleventyOptions` with options to customize
// Eleventy’s behavior (e.g., fine-grained control of caching,
// for instance).
/**
* @param {UserConfig} eleventyConfig
* @param {Object} [options = {}]
*/
export default function EleventyPluginPug(eleventyConfig, options = {}) {
// Tell Eleventy to process `*.pug` files
eleventyConfig.addTemplateFormats('pug')
// Prepare extension object
const PugExtension = EleventyPugExtension
PugExtension.options = Object.assign(PugExtension.options, options)
// PugExtension.options.basedir =
// options?.basedir
// ?? path.normalize(
// eleventyConfig.dir.input,
// eleventyConfig.dir.includes
// )
// Specify behavior for `*.pug` files
eleventyConfig.addExtension('pug', PugExtension)
}