@11ty/eleventy (main) doxdox documentation

A simpler static site generator.

# fn()

# restart()

Restarts Eleventy.

# this.fileSystemSearch()

# ...args(input, output, options, eleventyConfig)

Parameters

Name Types Description
input string - Directory or filename for input/sources files.
output string - Directory serving as the target for writing the output files.
options EleventyOptions
eleventyConfig TemplateConfig

# ConfigInitialized()

# configPath()

# directories()

# errorHandler()

# executeBuild()

tbd.

# getVersion()

Reads the version of Eleventy.

# getVersion()

# init()

Starts Eleventy.

# initializeEnvironmentVariables()

Set process.ENV variables for use in Eleventy projects

# input()

# inputDir()

# inputFile()

# logFinished()

Logs some statistics after a complete run of Eleventy.

# logger()

# logger(logger)

Parameters

Name Types Description
logger ConsoleLogger

# Map()

# MinimalCore()

Eleventy’s programmatic API

# outputDir()

# pathPrefix()

# resetConfig()

Resets the config of Eleventy.

# restart()

Restarts Eleventy.

# setDryRun(isDryRun)

Updates the dry-run mode of Eleventy.

Parameters

Name Types Description
isDryRun boolean - Shall Eleventy run in dry mode?

# setFormats(formats)

Updates the template formats of Eleventy.

Parameters

Name Types Description
formats string - The new template formats.

# setIgnoreInitial(ignoreInitialBuild)

Set whether or not to do an initial build

Parameters

Name Types Description
ignoreInitialBuild boolean - Shall Eleventy ignore the default initial build before watching in watch/serve mode?

# setIncrementalBuild(isIncremental)

Sets the incremental build mode.

Parameters

Name Types Description
isIncremental boolean - Shall Eleventy run in incremental build mode and only write the files that trigger watch updates

# setIncrementalFile(incrementalFile)

Set the file that needs to be rendered/compiled/written for an incremental build. This method is also wired up to the CLI --incremental=incrementalFile

Parameters

Name Types Description
incrementalFile string - File path (added or modified in a project)

# setIsVerbose(isVerbose)

Updates the verbose mode of Eleventy.

Parameters

Name Types Description
isVerbose boolean - Shall Eleventy run in verbose mode?

# setPathPrefix(pathPrefix)

Updates the path prefix used in the config.

Parameters

Name Types Description
pathPrefix string - The new path prefix.

# setRunMode(runMode)

Updates the run mode of Eleventy.

Parameters

Name Types Description
runMode string - One of "build", "watch", or "serve"

# this.bench()

# this.buildCount()

# this.config()

# this.eleventyConfig()

# this.isDryRun()

# this.isIncremental()

# this.isRunInitialBuild()

# this.loader()

# this.options()

# this.programmaticApiIncrementalFile()

# this.rawInput()

# this.rawOutput()

# this.runMode()

# this.runMode()

# this.source()

# this.start()

# toJSON()

Renders templates to a JSON object.

# verboseMode(value)

Parameters

Name Types Description
value boolean

# verboseMode()

# write(subtype)

Writes templates to the file system.

Parameters

Name Types Description
subtype String - (optional) or "templates" (skips passthrough copy) or "copy" (skips templates)

# addFileToWatchQueue(changedFilePath, isResetConfig)

Parameters

Name Types Description
changedFilePath string - File that triggered a re-run (added or modified)
isResetConfig boolean - are we doing a config reset

# getHelp()

Shows a help message including usage.

# getHelp()

# getWatchedTargets()

Returns all watched paths

# init()

Starts Eleventy.

# initWatchDependencies()

Starts watching dependencies.

# serve(port)

Serve Eleventy on this port.

Parameters

Name Types Description
port Number - The HTTP port to serve Eleventy from.

# setIncrementalBuild(isIncremental)

Sets the incremental build mode.

Parameters

Name Types Description
isIncremental boolean - Shall Eleventy run in incremental build mode and only write the files that trigger watch updates

# startWatch()

Set up watchers and benchmarks.

# this.eleventyServe()

# this.watchTargets()

# watch()

Start watching files

# watcherBench()

# this.validTemplateLanguageKeys()

# criptImport()

Whether to use the module loader directly

# needsToReadFileContents()

# criptImport()

Use the module loader directly

# needsToReadFileContents()

JavaScript files defer to the module loader rather than read the files to strings

# ...args()

# permalinkNeedsCompilation()

# tokens()

# compile()

Make sure compile is implemented downstream.

Returns

Promise

# etLibrary()

# permalinkNeedsCompilation()

# ...args()

# constructor(message, originalError)

Parameters

Name Types Description
message string - The error message to display.
originalError unknown - The original error caught.

# EleventyBaseError()

This class serves as basis for all Eleventy-specific errors.

# bus()

Provides a global event bus that modules deep down in the stack can subscribe to from a global singleton for decoupled pub/sub.

# debug()

# eOverride()

# eOverride()

# function()

# _renderFileShortcodeFn()

# _renderStringShortcodeFn()

# compile()

# ConfigInitialized()

# options.tagName()

# RenderPlugin(eleventyConfig, options)

A plugin to add shortcodes to render an Eleventy template string (or file) inside of another template. {@link https://v3.11ty.dev/docs/plugins/render/}

Parameters

Name Types Description
eleventyConfig module:11ty/eleventy/UserConfig - User-land configuration instance.
options object - Plugin options

# renderShortcodeFn()

# EleventyConfigError()

Errors in eleventy config.

# EleventyPluginError()

Errors in eleventy plugins.

# existsCache()

# forceReloadConfig()

Force a reload of the configuration object.

# getConfig()

Returns the config object.

# getLocalProjectConfigFile()

Normalises local project config file path.

# getPathPrefix()

Gets the current path prefix denoting the root folder the output will be deployed to

# if()

# init()

Async-friendly init method

# initializeRootConfig()

Bootstraps the config object.

# mergeConfig()

Merges different config files together.

# requireLocalConfigFile()

Fetches and executes the local configuration file

# reset()

Resets the configuration.

# resetOnWatch()

Resets the configuration while in watch mode.

# setPathPrefix(pathPrefix)

Overwrites the path prefix.

Parameters

Name Types Description
pathPrefix String - The new path prefix.

# setProjectConfigPath(path)

Overwrites the config path.

Parameters

Name Types Description
path String - The new config path.

# TemplateConfig(customRootConfig, projectConfigPath)

Config for a template.

Parameters

Name Types Description
customRootConfig {} - tbd.
projectConfigPath String - Path to local project config.

# this.customRootConfig()

# this.overrides()

# UserConfig()

# uses()

# usesGraph()

# _stripDateFromSlug()

Removes dates in the format of YYYY-MM-DD from a given slug string candidate.

# ...args()

# ...args()

# _getPluginName(plugin)

Parameters

Name Types Description
plugin PluginDefinition

# addPlugin(plugin)

addPlugin: async friendly in 3.0

Parameters

Name Types Description
plugin PluginDefinition

# extensionOptions()

# getNamespacedName(name)

Parameters

Name Types Description
name string

# Plugin(plugin)

Parameters

Name Types Description
plugin string PluginDefinition

# resolvePlugin(name)

Parameters

Name Types Description
name string

# sthroughCopy(fileOrDir, copyOptions)

Adds a path to a file or directory to the list of pass-through copies which are copied as-is to the output.

Parameters

Name Types Description
fileOrDir string object
copyOptions object options for recursive-copy. see https://www.npmjs.com/package/recursive-copy#arguments default options are defined in TemplatePassthrough copyOptionsDefault

# this.benchmarkManager()

# this.benchmarkManager.get()

# this.benchmarkManager.get()

# this.benchmarks()

# this.chokidarConfig()

# this.collections()

# this.dir()

# this.directories()

# this.directoryAssignments()

# this.errorReporting()

# this.errorReporting()

# this.events()

# this.extensionConflictMap()

# this.globalData()

# this.javascript()

# this.layoutAliases()

# this.libraryAmendments()

# this.libraryOverrides()

# this.linters()

# this.liquid()

# this.logger()

# this.nunjucks()

# this.passthroughCopies()

# this.pathPrefix()

# this.precompiledCollections()

# this.preprocessors()

# this.serverOptions()

# this.transforms()

# this.universal()

# this.virtualTemplates()

# UserConfig()

Eleventy’s user-land Configuration API

# ...args()

# ...args(type, args)

Parameters

Name Types Description
type string - The event name to emit.
args ...* - Additional lazy-executed function arguments that get passed to listeners.

# AsyncEventEmitter()

This class emits events asynchronously. Note that Eleventy has two separate event emitter instances it uses: 1. a userland one (UserConfig.js) 2. a global one for internals (EventBus.js)

# ConsoleLogger()

Logger implementation that logs to STDOUT.

# error(msg)

Parameters

Name Types Description
msg string

# forceLog(msg)

Parameters

Name Types Description
msg string

# info(msg)

Parameters

Name Types Description
msg string

# log(msg)

Parameters

Name Types Description
msg string

# logWithOptions(options)

Parameters

Name Types Description
options LogOptions

# message(message, type, chalkColor, forceToConsole)

Formats the message to log.

Parameters

Name Types Description
message string - The raw message to log.
type LogType - The error level to log.
chalkColor string undefined
forceToConsole boolean - Enforce a log on console instead of specified target.

# warn(msg)

Parameters

Name Types Description
msg string

# this.callbacks()

# this.plugins()

# this.posthtmlProcessOptions()

# isUseAll()

# encoding()

# loadContents()

# function(config)

Default configuration object factory.

Parameters

Name Types Description
config config - Eleventy configuration object.

# function(config)

Extended default configuration object factory.

Parameters

Name Types Description
config config - Eleventy configuration object.