Skip to content

Bundle Plugin v4.1.0

Latest

Choose a tag to compare

@zachleat zachleat released this 18 Nov 17:14
Immutable release. Only release title and notes can be modified.
30164b5

New Inject Feature

New inject bundle feature (not enabled by default, opt-in) adds a bundle to every page without needing a getBundle or getBundleFileUrl #53 Pages that already reference the bundle using older methods are skipped.

  • Possible mode values: "inline" (true is shorthand), "file", or "size", which inlines bundles up to maxInlineSize bytes (default 4096) and writes larger ones to a file.
  • location: "<title>", "</head>" (default), "<body>", or "</body>"
  • missingLocation: "ignore" (default), "error", "append", or "prepend".
  • An optional html callback customizes the markup.
export default function($config) {
	$config.addBundle("css", { inject: "inline" });
}
// Full options list
export default function($config) {
	$config.addBundle("css", {
		inject: {
			mode: "inline", // or "file" or "size"
			location: "</head>", // or "<title>", "<body>", "</body>"
			missingLocation: "ignore", // or "error", "append", "prepend"
			maxInlineSize: 4096, // bytes, only used by "size"
			html: ({ mode, name }) => mode === "inline"
				? `<style>%s</style>`
				: `<link rel="stylesheet" href="%s">`,
		},
	});
}

Other changes

  • Fixes #54 with nonce added to out of order render placeholders
  • Swaps posthtml-match-helper for the zero-dependency @11ty/posthtml-match-selector
  • Swap from node:crypto to web standard WebCrypto

Full Changelog: v4.0.3...v4.1.0