Minify HTML & CSS (#1351)

Signed-off-by: Daniel Gray <dng@disroot.org>
This commit is contained in:
Jonah Aragon 2022-05-29 17:52:50 +00:00 committed by Daniel Gray
parent f6a25a7dd4
commit a52770e1c0
No known key found for this signature in database
GPG Key ID: 41911F722B0F9AE3
11 changed files with 45 additions and 14 deletions

View File

@ -9,6 +9,7 @@ mkdocs-material = {path = "./mkdocs-material"}
mkdocs-static-i18n = "*" mkdocs-static-i18n = "*"
mkdocs-git-revision-date-localized-plugin = "*" mkdocs-git-revision-date-localized-plugin = "*"
typing-extensions = "*" typing-extensions = "*"
mkdocs-minify-plugin = "*"
[dev-packages] [dev-packages]
scour = "*" scour = "*"

46
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "2d68765ce86bf264f0a29d6b9f31202a71615d6aad4653cffc874bd095267d29" "sha256": "76ed583036efde0ea1b0725942175f9c77c8a04f218b4822cc8dcc0f8174e2f4"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -41,11 +41,11 @@
}, },
"certifi": { "certifi": {
"hashes": [ "hashes": [
"sha256:6ae10321df3e464305a46e997da41ea56c1d311fb9ff1dd4e04d6f14653ec63a", "sha256:9c5705e395cd70084351dd8ad5c41e65655e08ce46f2ec9cf6c2c08390f71eb7",
"sha256:8d15a5a7fde18536a249c49e07e8e462b8fc13de21b3c80e8a68315dfa227c99" "sha256:f1d53542ee8cbedbe2118b5686372fb33c297fcd6379b050cca0ef13a597382a"
], ],
"markers": "python_version >= '3.5'", "markers": "python_version >= '3.6'",
"version": "==2022.5.18" "version": "==2022.5.18.1"
}, },
"cffi": { "cffi": {
"hashes": [ "hashes": [
@ -107,7 +107,7 @@
"sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597", "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597",
"sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df" "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"
], ],
"markers": "python_version >= '3'", "markers": "python_version >= '3.0'",
"version": "==2.0.12" "version": "==2.0.12"
}, },
"click": { "click": {
@ -118,6 +118,12 @@
"markers": "python_version >= '3.7'", "markers": "python_version >= '3.7'",
"version": "==8.1.3" "version": "==8.1.3"
}, },
"csscompressor": {
"hashes": [
"sha256:afa22badbcf3120a4f392e4d22f9fff485c044a1feda4a950ecc5eba9dd31a05"
],
"version": "==0.9.5"
},
"cssselect2": { "cssselect2": {
"hashes": [ "hashes": [
"sha256:3a83b2a68370c69c9cd3fcb88bbfaebe9d22edeef2c22d1ff3e1ed9c7fa45ed8", "sha256:3a83b2a68370c69c9cd3fcb88bbfaebe9d22edeef2c22d1ff3e1ed9c7fa45ed8",
@ -157,21 +163,27 @@
"markers": "python_version >= '3.7'", "markers": "python_version >= '3.7'",
"version": "==3.1.27" "version": "==3.1.27"
}, },
"htmlmin": {
"hashes": [
"sha256:50c1ef4630374a5d723900096a961cff426dff46b48f34d194a81bbe14eca178"
],
"version": "==0.1.12"
},
"idna": { "idna": {
"hashes": [ "hashes": [
"sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff", "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",
"sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d" "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
], ],
"markers": "python_version >= '3'", "markers": "python_version >= '3.0'",
"version": "==3.3" "version": "==3.3"
}, },
"importlib-metadata": { "importlib-metadata": {
"hashes": [ "hashes": [
"sha256:1208431ca90a8cca1a6b8af391bb53c1a2db74e5d1cef6ddced95d4b2062edc6", "sha256:5d26852efe48c0a32b0509ffbc583fda1a2266545a78d104a6f4aff3db17d700",
"sha256:ea4c597ebf37142f827b8f39299579e31685c31d3a438b59f469406afd0f2539" "sha256:c58c8eb8a762858f49e18436ff552e83914778e50e9d2f1660535ffb364552ec"
], ],
"markers": "python_version >= '3.7'", "markers": "python_version >= '3.7'",
"version": "==4.11.3" "version": "==4.11.4"
}, },
"jinja2": { "jinja2": {
"hashes": [ "hashes": [
@ -181,6 +193,12 @@
"markers": "python_version >= '3.6'", "markers": "python_version >= '3.6'",
"version": "==3.0.3" "version": "==3.0.3"
}, },
"jsmin": {
"hashes": [
"sha256:c0959a121ef94542e807a674142606f7e90214a2b3d1eb17300244bbb5cc2bfc"
],
"version": "==3.0.1"
},
"lxml": { "lxml": {
"hashes": [ "hashes": [
"sha256:078306d19a33920004addeb5f4630781aaeabb6a8d01398045fcde085091a169", "sha256:078306d19a33920004addeb5f4630781aaeabb6a8d01398045fcde085091a169",
@ -338,6 +356,14 @@
"markers": "python_version >= '3.6'", "markers": "python_version >= '3.6'",
"version": "==1.0.3" "version": "==1.0.3"
}, },
"mkdocs-minify-plugin": {
"hashes": [
"sha256:32d9e8fbd89327a0f4f648f517297aad344c1bad64cfde110d059bd2f2780a6d",
"sha256:487c31ae6b8b3230f56910ce6bcf5c7e6ad9a8c4f51c720a4b989f30c2b0233f"
],
"index": "pypi",
"version": "==0.5.0"
},
"mkdocs-static-i18n": { "mkdocs-static-i18n": {
"hashes": [ "hashes": [
"sha256:5d69b4eb284931bd048a36f923367f2a7bd0dc7b0438008dce8ca1a8feee99e2" "sha256:5d69b4eb284931bd048a36f923367f2a7bd0dc7b0438008dce8ca1a8feee99e2"

View File

@ -74,7 +74,7 @@ This website uses [`mkdocs-material-insiders`](https://squidfunk.github.io/mkdoc
- `git submodule init` - `git submodule init`
- `git submodule update docs/assets/brand` - `git submodule update docs/assets/brand`
2. Install [Python 3.6+](https://www.python.org/downloads/) 2. Install [Python 3.6+](https://www.python.org/downloads/)
3. Install [dependencies](/Pipfile): `pip install mkdocs mkdocs-material mkdocs-static-i18n mkdocs-git-revision-date-localized-plugin typing-extensions` 3. Install [dependencies](/Pipfile): `pip install mkdocs mkdocs-material mkdocs-static-i18n mkdocs-git-revision-date-localized-plugin mkdocs-minify-plugin typing-extensions`
4. Serve the site locally: `mkdocs serve` 4. Serve the site locally: `mkdocs serve`
- The site will be available at `http://localhost:8000` - The site will be available at `http://localhost:8000`
- You can build the site locally with `mkdocs build` - You can build the site locally with `mkdocs build`

View File

@ -77,6 +77,10 @@ watch:
- includes - includes
plugins: plugins:
- minify:
minify_html: true
htmlmin_opts:
remove_comments: true
- i18n: - i18n:
default_language: en default_language: en
material_alternate: true material_alternate: true
@ -133,8 +137,8 @@ markdown_extensions:
toc_depth: 4 toc_depth: 4
extra_javascript: extra_javascript:
- javascripts/mathjax.js - assets/javascripts/mathjax.js
- javascripts/feedback.js - assets/javascripts/feedback.js
nav: nav:
- Home: 'index.md' - Home: 'index.md'

View File

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block extrahead %} {% block extrahead %}
<link rel="stylesheet" href="{{ 'overrides/home.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/home.css' | url }}">
<link rel="me" href="https://aragon.sh/@jonah"> <link rel="me" href="https://aragon.sh/@jonah">
<link rel="me" href="https://fosstodon.org/@freddy"> <link rel="me" href="https://fosstodon.org/@freddy">
<link rel="me" href="https://mastodon.social/@dngray"> <link rel="me" href="https://mastodon.social/@dngray">