Skip to content

Commit

Permalink
revert(page): minify HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
brainwo committed May 20, 2024
1 parent ad9b31b commit 36b4b17
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 195 deletions.
16 changes: 4 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import fs from "node:fs";
import { getFilteredUrlFromFeed } from "./src/filter.js";
import { extract } from "@extractus/article-extractor";
import Mustache from "mustache";
import { minify } from "html-minifier-terser";

const outputPath = "public";
const feedOutput = `${outputPath}/feed.xml`;
Expand Down Expand Up @@ -52,7 +51,8 @@ function writeToFile(rssItem) {
feedOutput,
Mustache.render(feedTemplate, { items: rssItem })
);
minify(
fs.writeFileSync(
pageOutput,
Mustache.render(pageTemplate, {
items: rssItem,
hostname: function () {
Expand All @@ -61,16 +61,8 @@ function writeToFile(rssItem) {
shortTitle: function () {
return this.article.title.split(/[|—–]/)[0].trim();
},
}),
{
collapseWhitespace: true,
minifyJS: true,
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: true,
removeOptionalTags: true,
removeComments: true,
}
).then((minifiedHtml) => fs.writeFileSync(pageOutput, minifiedHtml));
})
);
}

/**
Expand Down
Loading

0 comments on commit 36b4b17

Please sign in to comment.