Skip to content

Commit

Permalink
Adjusted config
Browse files Browse the repository at this point in the history
  • Loading branch information
Akashic101 committed May 13, 2024
1 parent 983cfa7 commit bcf4929
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs');
const path = require('path');
const htmlNano = require('htmlnano');
const tocPlugin = require('eleventy-plugin-toc');
const markdownItAnchor = require('markdown-it-anchor');
const pluginRss = require('@11ty/eleventy-plugin-rss');
Expand Down Expand Up @@ -126,6 +127,20 @@ module.exports = function (eleventyConfig) {
});

eleventyConfig.addTransform('addFileSize', require('./src/_transforms/addFileSize.js'));
eleventyConfig.addTransform('htmlnano', async (content, outputPath) => {
if (outputPath.endsWith('.html')) {
const { html } = await htmlNano.process(content, {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: true,
});
return html;
}
return content;
});

return {
dir: {
input: 'src',
Expand Down

0 comments on commit bcf4929

Please sign in to comment.