-
5onderling jed_fox1 You can do precompiling by running programmatic Eleventy in a
eleventy.beforeevent. But we’re thinking about a cleaner method around this by allow custom pre-processing hooks, info box here describes it 11ty.dev/docs/languages/custom/#introductory-example-*.clowd
{
let el = new Eleventy(".", ".", {
configPath: "precompile.eleventy.js"
});
await el.init();
await el.write();
console.log( "✅ Precompiled Typescript" );
})
};
precompile.eleventy.js:
const ts = require("typescript");
module.exports = function(eleventyConfig) {
eleventyConfig.setTemplateFormats("ts");
eleventyConfig.addExtension("ts", {
outputFileExtension: "11ty.js",
compile: function(source) {
return function() {
let ret = ts.transpileModule(source, {
compilerOptions: {
module: ts.ModuleKind.CommonJS
}
});
return ret.outputText;
};
}
});
};" class="tweet-media" onerror="fallbackMedia(this)" loading="lazy" decoding="async">
Chronotope’s Twitter Archive—№ 143,489