Tucker McKnight <tucker@pangolin.lan> | Fri Jan 02 2026
Change raw template to typescript template
-1 0 1 2 3 4
export default async (eleventyConfig: any) => {
const getFileContents = eleventyConfig.getFilter("getFileContents")
return async (data) => {
return await getFileContents(data.fileInfo.repoName, data.fileInfo.branchName, data.fileInfo.file)
}
}19 20 21 22 23
import commitsJsTemplate from './js_templates/commits.ts'
import indexJsTemplate from './js_templates/index.ts'
import branchesJsTemplate from './js_templates/branches.ts'
const ajv = new Ajv()
const exec = util.promisify(childProcess.exec)19 20 21 22 23 24
import commitsJsTemplate from './js_templates/commits.ts'
import indexJsTemplate from './js_templates/index.ts'
import branchesJsTemplate from './js_templates/branches.ts'
import rawJsTemplate from './js_templates/raw.ts'
const ajv = new Ajv()
const exec = util.promisify(childProcess.exec)336 337 338 339 340 341 342 343 344 345
}
)
// RAW.NJK
const rawTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/raw.njk`).toString()
eleventyConfig.addTemplate(
'repos/raw.njk',
rawTemplate,
{
pagination: {
data: "flatFiles",336 337 338 339 340 341 342 343 344 345
}
)
// RAW.TS
const rawTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/raw.njk`).toString()
eleventyConfig.addTemplate(
'repos/raw.11ty.js',
rawJsTemplate(eleventyConfig),
{
pagination: {
data: "flatFiles",0
{% set fileContents = fileInfo.repoName | getFileContents(fileInfo.branchName, fileInfo.file) %}
{{- fileContents | safe -}}