chore: minify + inline non-tailwind styles
This commit is contained in:
parent
16215082f1
commit
e30dc3784e
4 changed files with 19 additions and 2 deletions
|
@ -11,6 +11,7 @@ const markdownItFootnote = require('markdown-it-footnote')
|
||||||
const filters = require('./config/filters.js')
|
const filters = require('./config/filters.js')
|
||||||
const dateFilters = require('./config/dateFilters.js')
|
const dateFilters = require('./config/dateFilters.js')
|
||||||
const mediaFilters = require('./config/mediaFilters.js')
|
const mediaFilters = require('./config/mediaFilters.js')
|
||||||
|
const CleanCSS = require('clean-css')
|
||||||
const now = String(Date.now())
|
const now = String(Date.now())
|
||||||
|
|
||||||
// load .env
|
// load .env
|
||||||
|
@ -52,6 +53,9 @@ module.exports = function (eleventyConfig) {
|
||||||
eleventyConfig.addLiquidFilter(filterName, mediaFilters[filterName])
|
eleventyConfig.addLiquidFilter(filterName, mediaFilters[filterName])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// css filters
|
||||||
|
eleventyConfig.addFilter('cssmin', (code) => new CleanCSS({}).minify(code).styles)
|
||||||
|
|
||||||
// enable merging of tags
|
// enable merging of tags
|
||||||
eleventyConfig.setDataDeepMerge(true)
|
eleventyConfig.setDataDeepMerge(true)
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
||||||
"@typescript-eslint/parser": "^5.59.7",
|
"@typescript-eslint/parser": "^5.59.7",
|
||||||
"autoprefixer": "^10.4.2",
|
"autoprefixer": "^10.4.2",
|
||||||
|
"clean-css": "^5.3.2",
|
||||||
"dotenv-flow": "^3.2.0",
|
"dotenv-flow": "^3.2.0",
|
||||||
"eleventy-plugin-unfurl": "^1.0.0",
|
"eleventy-plugin-unfurl": "^1.0.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
||||||
|
|
|
@ -29,8 +29,13 @@
|
||||||
href="/assets/img/favicon/favicon-32x32.png">
|
href="/assets/img/favicon/favicon-32x32.png">
|
||||||
<link rel="apple-touch-icon" href="/assets/img/favicon/apple-touch-icon.png">
|
<link rel="apple-touch-icon" href="/assets/img/favicon/apple-touch-icon.png">
|
||||||
<link href="/assets/styles/tailwind.css?v={% version %}" rel="stylesheet" />
|
<link href="/assets/styles/tailwind.css?v={% version %}" rel="stylesheet" />
|
||||||
<link href="/assets/styles/prism.css?v={% version %}" rel="stylesheet" />
|
{% capture css %}
|
||||||
<link href="/assets/styles/index.css?v={% version %}" rel="stylesheet" />
|
{% include "../assets/styles/prism.css" %}
|
||||||
|
{% include "../assets/styles/index.css" %}
|
||||||
|
{% endcapture %}
|
||||||
|
<style>
|
||||||
|
{{ css | cssmin }}
|
||||||
|
</style>
|
||||||
{% if env != 'development' %}
|
{% if env != 'development' %}
|
||||||
<script>
|
<script>
|
||||||
window.va = window.va || function() {
|
window.va = window.va || function() {
|
||||||
|
|
|
@ -1337,6 +1337,13 @@ clean-css@^4.2.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
source-map "~0.6.0"
|
source-map "~0.6.0"
|
||||||
|
|
||||||
|
clean-css@^5.3.2:
|
||||||
|
version "5.3.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.3.2.tgz#70ecc7d4d4114921f5d298349ff86a31a9975224"
|
||||||
|
integrity sha512-JVJbM+f3d3Q704rF4bqQ5UUyTtuJ0JRKNbTKVEeujCCBoMdkEi+V+e8oktO9qGQNSvHrFTM6JZRXrUvGR1czww==
|
||||||
|
dependencies:
|
||||||
|
source-map "~0.6.0"
|
||||||
|
|
||||||
clean-stack@^2.0.0:
|
clean-stack@^2.0.0:
|
||||||
version "2.2.0"
|
version "2.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
|
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
|
||||||
|
|
Reference in a new issue