add srt files

This commit is contained in:
2024-12-24 15:20:16 -06:00
parent 3129677921
commit 566cdab6d6
95 changed files with 1199450 additions and 16 deletions

View File

@@ -3,6 +3,8 @@ const handlebars = require('handlebars');
const sass = require("sass");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const handlebarsHelpers = require('handlebars-helpers')
const { parseSync } = require('subtitle')
const path = require('path')
const htmlmin = require("html-minifier");
@@ -21,23 +23,36 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(utilsPlugin, {immediate: true});
eleventyConfig.addPlugin(handlebarsPlugin);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addTemplateFormats("srt");
eleventyConfig.addExtension(
"srt",
{compile: (inputContent, inputPath)=>{
const parsed = parseSync(inputContent.toString(), {type:'srt'})
return async (data) => {
data.transcript = parsed
data.layout = "transcript"
// data.tags = ['transcript']
return JSON.stringify(parsed)
}
}})
handlebarsHelpers({
handlebars
})
eleventyConfig.addTransform("htmlmin", (content, outputPath) => {
if (outputPath.endsWith(".html")) {
return htmlmin.minify(content, {
collapseWhitespace: true,
removeComments: true,
useShortDoctype: true,
});
}
// eleventyConfig.addTransform("htmlmin", (content, outputPath) => {
// if (outputPath.endsWith(".html")) {
// return htmlmin.minify(content, {
// collapseWhitespace: true,
// removeComments: true,
// useShortDoctype: true,
// });
// }
return content;
});
// return content;
// });
// Creates the extension for use
eleventyConfig.addTemplateFormats("scss");