@genehack/my-eleventy-config
v1.0.0
Published
modular, configurable, reusable config for TypeScript-based 11ty sites
Downloads
7
Readme
my-eleventy-config
A modular, configurable, reusable configuration for 11ty-based websites that use TypeScript for configuration.
how to use this package
See 11ty's TypeScript docs on how to use a TypeScript-based configuration file for your 11ty site, then:
In your individual site, add this package as a dependency:
npm i --save @genehack/my-eleventy-configIn your site's
eleventy.config.tsfile, import the module, override any of the default configuration values you'd like to change (see below for what those defaults are), and in the first line of the default export, load the plugin with a spread version of your config overrides and theintermediate: trueflag:import eleventy from "@11ty/eleventy"; import myConfig from "@genehack/my-eleventy-config"; const myConfigConfig = { enableCssMinimization: false, passthrough: { dirs: ["fonts"], files: [], }, }; export default async function (config: eleventy.LocalConfig): Promise<void> { await config.addPlugin(myConfig, { ...myConfigConfig, immediate: true }); // rest of your custom config goes here… }
default configuration
By default, the plugin provides this configuration:
{
enableCssMinimization: true,
enableDrafts: true,
enableImageOptimization: true,
enableScss: true,
enableSyntaxHighlighting: true,
feeds: {
atom: false,
json: false,
rss: false,
},
markdownItOptions: {
html: true,
linkify: true,
typographer: true,
},
passthrough: {
dirs: [],
files: [],
},
templateFormats: ["html", "md", "njk"],
}TODO FIXME document what the options do
important note
Currently, because of the way config overrides are applied, if you
override a top-level default, (e.g., passthrough), you must provide
all the keys present in the default. For example, if you wanted to add
an images directory to passthru:dirs, your config override would
need to look like:
const myConfigConfig = {
passthrough: {
dirs: ["images"],
files: [],
},
};Emitting the passthrough:files key will result in an error.
