A zero-runtime transpiler that expands custom component DSLs with slot syntax directly on the Pug AST. Version 0.1.0-alpha.6 targets Node >=18, ships TypeScript type definitions, and is in early alpha stage. Unlike runtime slot systems (e.g., Vue slots), pug-tail performs static expansion at build time, producing plain Pug output with no client-side overhead. It offers a Vue-like slot syntax (named, scoped, fallback) but compiles away entirely. The project has irregular release cadence and is not yet stable. Key differentiators: no runtime cost, AST-level transformation, and integration with existing Pug toolchains.
npm install pug-tailNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Expands a custom component with a slot in Pug AST, converting slot content into component children.
Pin exact version and test upgrades thoroughly.
const copy = JSON.parse(JSON.stringify(ast)); extend(copy, options);
Replace compile(ast, options) with extend(ast, options) then manually serialize.
Ensure every slot in the component definition has a fallback: false or valid AST.
Use Node >=18.
Ensure options.components is an object with keys matching component names, each having a template AST node.
Either add a slot named 'default' to the component definition, or rename the slot reference.
Use a custom serializer (e.g., from 'pug-walk') instead of JSON.stringify.