This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { PurgeCSS } = require('purgecss'); | |
/** | |
* Remove any CSS not used on the page and inline the remaining CSS in the | |
* <head>. | |
* | |
* @see {@link https://github.com/FullHuman/purgecss} | |
*/ | |
eleventyConfig.addTransform('purge-and-inline-css', async (content, outputPath) => { | |
if (process.env.ELEVENTY_ENV !== 'production' || !outputPath.endsWith('.html')) { |