diff --git a/.eleventy.js b/.eleventy.js index de27046c..d46ceaf3 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -11,6 +11,7 @@ const markdownItFootnote = require('markdown-it-footnote') const filters = require('./config/filters.js') const dateFilters = require('./config/dateFilters.js') const mediaFilters = require('./config/mediaFilters.js') +const CleanCSS = require('clean-css') const now = String(Date.now()) // load .env @@ -52,6 +53,9 @@ module.exports = function (eleventyConfig) { eleventyConfig.addLiquidFilter(filterName, mediaFilters[filterName]) }) + // css filters + eleventyConfig.addFilter('cssmin', (code) => new CleanCSS({}).minify(code).styles) + // enable merging of tags eleventyConfig.setDataDeepMerge(true) diff --git a/package.json b/package.json index f1300bbd..99235434 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@typescript-eslint/eslint-plugin": "^5.59.7", "@typescript-eslint/parser": "^5.59.7", "autoprefixer": "^10.4.2", + "clean-css": "^5.3.2", "dotenv-flow": "^3.2.0", "eleventy-plugin-unfurl": "^1.0.0", "eslint-plugin-jsx-a11y": "^6.7.1", diff --git a/src/_includes/base.liquid b/src/_includes/base.liquid index 0f2ace9f..1db60dc4 100644 --- a/src/_includes/base.liquid +++ b/src/_includes/base.liquid @@ -29,8 +29,13 @@ href="/assets/img/favicon/favicon-32x32.png"> - - + {% capture css %} + {% include "../assets/styles/prism.css" %} + {% include "../assets/styles/index.css" %} + {% endcapture %} + {% if env != 'development' %}