Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passing Pug options in @11ty/eleventy-plugin-pug #17

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pug/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ export const DEFAULT_PUG_OPTIONS = {

/**
* The root directory of all absolute inclusion.
* @type {String}
* @type {String|undefined}
* @default undefined
*/
basedir: '.',
basedir: undefined,

/**
* If the doctype is not specified as part of the template, you can specify it here.
Expand Down
11 changes: 9 additions & 2 deletions pug/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@ const extension = {
debugDev('rendering... received arg: %O', arg)
debug( 'about to render... inputPath: %O', inputPath)

// TODO: clean up the setup and updating of options
const renderOptions = Object.assign(
{},
{
basedir: arg.eleventy.directories.includes,
basedir: extension.options.basedir ?? arg.eleventy.directories.includes,
filename: inputPath,
filters: extension.options.filters,
doctype: extension.options.doctype,
pretty: extension.options.pretty,
self: extension.options.self,
debug: extension.options.debug,
compileDebug: extension.options.compileDebug,
globals: extension.options.globals,
cache: extension.options.cache,
inlineRuntimeFunctions: extension.options.inlineRuntimeFunctions,
},
arg
)
Expand Down