From 21b292891878f85c27b5bbddeba1ba8de9c8b493 Mon Sep 17 00:00:00 2001 From: Ari Archer Date: Sun, 8 Oct 2023 01:44:35 +0300 Subject: [PATCH] switch back to css-html-js-minify Signed-off-by: Ari Archer --- requirements.txt | 3 +-- robots.txt | 4 ++++ scripts/blog.py | 36 ++++++++++-------------------------- sitemap.xml | 2 ++ 4 files changed, 17 insertions(+), 28 deletions(-) create mode 100644 robots.txt create mode 100644 sitemap.xml diff --git a/requirements.txt b/requirements.txt index cd095ea..d6c8521 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ -htmlmin -rcssmin +css-html-js-minify mistune typing readtime diff --git a/robots.txt b/robots.txt new file mode 100644 index 0000000..763ef43 --- /dev/null +++ b/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Disallow: /content/* +Allow: * +Sitemap: https://blog.ari-web.xyz/sitemap.xml \ No newline at end of file diff --git a/scripts/blog.py b/scripts/blog.py index b01d4dc..4934e19 100755 --- a/scripts/blog.py +++ b/scripts/blog.py @@ -24,13 +24,13 @@ from threading import Thread from timeit import default_timer as code_timer from warnings import filterwarnings as filter_warnings -import htmlmin import mistune import mistune.core import mistune.inline_parser import mistune.plugins -import rcssmin # type: ignore import unidecode +from css_html_js_minify import html_minify # type: ignore +from css_html_js_minify import process_single_css_file # type: ignore from readtime import of_markdown as read_time_of_markdown # type: ignore __version__: typing.Final[int] = 2 @@ -557,24 +557,6 @@ def read_post(path: str) -> str: return "" -def process_css(code: str) -> str: - return rcssmin.cssmin(code) # type: ignore - - -def process_css_from_file(file: str) -> str: - with open(file, "r") as css: - return process_css(css.read()) - - -def process_css_file(file: str, out: str) -> None: - with open(out, "w") as css: - css.write(process_css_from_file(file)) - - -def min_html(code: str) -> str: - return htmlmin.minify(code, True, True, True, True, True, True, True) - - # markdown TITLE_LINKS_RE: typing.Final[str] = r"<#:[^>]+?>" @@ -882,10 +864,12 @@ def build(config: dict[str, typing.Any]) -> int: post_crit_css: str = "" if os.path.isfile(critp := f"{config['assets-dir']}/critical.css"): - crit_css = process_css_from_file(critp) + with open(critp, "r") as fp: + crit_css = fp.read() if os.path.isfile(critp := f"{config['assets-dir']}/post_critical.css"): - post_crit_css = process_css_from_file(critp) + with open(critp, "r") as fp: + post_crit_css = fp.read() def build_post(slug: str, post: dict[str, typing.Any]) -> None: ct: float = ctimer() @@ -895,7 +879,7 @@ def build(config: dict[str, typing.Any]) -> int: with open(f"{post_dir}/index.html", "w") as html: html.write( - min_html( + html_minify( POST_TEMPLATE.format( lang=lang, keywords=html_escape( @@ -952,7 +936,7 @@ def build(config: dict[str, typing.Any]) -> int: with open("index.html", "w") as index: index.write( - min_html( + html_minify( INDEX_TEMPLATE.format( # type: ignore lang=lang, keywords=html_escape(", ".join(config["blog-keywords"])), @@ -1014,7 +998,7 @@ def css(config: dict[str, typing.Any]) -> int: if os.path.isfile(styles := f"{config['assets-dir']}/styles.css"): lnew(f"minifying {styles!r}") - _thread(process_css_file, styles, f"{config['assets-dir']}/styles.min.css") # type: ignore + _thread(process_single_css_file, styles, f"{config['assets-dir']}/styles.min.css") # type: ignore if os.path.isdir(fonts := f"{config['assets-dir']}/fonts"): log(f"minifying fonts in {fonts!r}") @@ -1023,7 +1007,7 @@ def css(config: dict[str, typing.Any]) -> int: if fcss.endswith(".min.css"): continue - _thread(process_css_file, fcss, f"{os.path.splitext(fcss)[0]}.min.css") # type: ignore + _thread(process_single_css_file, fcss, f"{os.path.splitext(fcss)[0]}.min.css") # type: ignore for t in ts: t.join() diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..80f5e28 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,2 @@ + +https://ari-web.xyz2023-10-07T19:40:49+00:001.0https://blog.ari-web.xyz2023-10-07T19:40:49+00:001.0https://blog.ari-web.xyz/rss.xml2023-10-07T19:40:49+00:001.0https://blog.ari-web.xyz/b/leaking-windows-11-home-key2023-10-01T20:18:35+00:001.0https://blog.ari-web.xyz/b/linux2023-09-13T18:21:38+00:001.0https://blog.ari-web.xyz/b/omg-pls-stop2023-09-06T07:57:03+00:001.0https://blog.ari-web.xyz/b/blogging-system-rewrite-again-32023-08-29T04:26:53+00:001.0https://blog.ari-web.xyz/b/install-lineageos-root-ur-xiomi-redmi-8-phone-using-magisk2023-09-07T10:55:41+00:001.0https://blog.ari-web.xyz/b/doml-7-2023-08-232023-08-23T01:13:50+00:001.0https://blog.ari-web.xyz/b/vegan-dumplings-recipe-ig-lol2023-08-10T14:52:30+00:001.0https://blog.ari-web.xyz/b/happy-1000-days-ari-web2023-07-17T15:19:50+00:001.0https://blog.ari-web.xyz/b/doml-6-2023-06-272023-06-26T21:47:14+00:001.0https://blog.ari-web.xyz/b/transgender2023-05-23T18:29:32+00:001.0https://blog.ari-web.xyz/b/schrödingers-crush2023-05-17T18:09:30+00:001.0https://blog.ari-web.xyz/b/feel-cool-reported-bug-company-got-paid-1002023-05-07T19:42:19+00:001.0https://blog.ari-web.xyz/b/doml-5-2023-05-062023-05-06T15:31:04+00:001.0https://blog.ari-web.xyz/b/george-orwell-19842023-05-02T14:24:49+00:001.0https://blog.ari-web.xyz/b/transphobia2023-04-27T19:23:32+00:001.0https://blog.ari-web.xyz/b/corporate-marionettes2023-04-25T23:23:36+00:001.0https://blog.ari-web.xyz/b/torturetric-system2023-04-13T20:30:47+00:001.0https://blog.ari-web.xyz/b/userari-webxyz-situation2023-04-09T22:39:50+00:001.0https://blog.ari-web.xyz/b/serverari-webxyz-going-be-changed2023-04-09T12:51:08+00:001.0https://blog.ari-web.xyz/b/doml-4-2023-04-072023-04-07T14:19:25+00:001.0https://blog.ari-web.xyz/b/ari-web-index-redesign2023-04-05T23:01:24+00:001.0https://blog.ari-web.xyz/b/ari-web-blog-api-change2023-04-04T19:29:02+00:001.0https://blog.ari-web.xyz/b/twitter2023-04-01T22:14:40+00:001.0https://blog.ari-web.xyz/b/ari-web-server-https-serverari-webxyz2023-03-25T21:44:59+00:001.0https://blog.ari-web.xyz/b/ghosts2023-03-17T22:33:40+00:001.0https://blog.ari-web.xyz/b/close-door-beginner-friendly-lecture-parents2023-03-09T17:02:20+00:001.0https://blog.ari-web.xyz/b/bash-syntax-highlighting-part-one-concept2023-03-05T13:59:54+00:001.0https://blog.ari-web.xyz/b/doml-3-2023-03-012023-03-01T19:46:23+00:001.0https://blog.ari-web.xyz/b/low-calorie-vegetarian-bean-soup2023-02-04T20:17:20+00:001.0https://blog.ari-web.xyz/b/doml-2-2023-02-022023-02-02T13:57:28+00:001.0https://blog.ari-web.xyz/b/i-came-out-to-my-psychologist-an-update2023-01-30T13:06:52+00:001.0https://blog.ari-web.xyz/b/doml-1-2023-01-292023-01-29T02:11:39+00:001.0https://blog.ari-web.xyz/b/how-does-it-feel-to-be-a-lab-rat2023-01-21T20:50:23+00:001.0https://blog.ari-web.xyz/b/chatgpt-fun2023-01-19T20:07:23+00:001.0https://blog.ari-web.xyz/b/i-came-out-to-my-psychologist2023-01-16T18:06:33+00:001.0https://blog.ari-web.xyz/b/netlify-tos-terms-of-service-tldr2022-12-25T21:45:27+00:001.0https://blog.ari-web.xyz/b/idk-something2022-12-25T02:11:02+00:001.0https://blog.ari-web.xyz/b/pievos-dūno-upė-lyrics-pievos-dūno-upė-žodžiai2022-12-03T01:10:55+00:001.0https://blog.ari-web.xyz/b/advent-of-code-20222022-11-28T16:18:41+00:001.0https://blog.ari-web.xyz/b/comparison-between-the-oh-my-bash-and-baz-plugin-managers-for-gnu-bash2022-11-18T00:14:19+00:001.0https://blog.ari-web.xyz/b/gnu-bash-script-and-general-code-optimisation-tips2022-11-01T01:13:10+00:001.0https://blog.ari-web.xyz/b/how-to-make-your-first-website2022-10-30T17:46:21+00:001.0https://blog.ari-web.xyz/b/minimal-software-i-made-for-linux-systems2022-10-29T20:15:22+00:001.0https://blog.ari-web.xyz/b/-thinkpeach--not--thinkpink2022-10-27T13:56:03+00:001.0https://blog.ari-web.xyz/b/leaking-your-ip-is-not-dangerous--please-stop-being-so-stupid2022-10-21T16:44:16+00:001.0https://blog.ari-web.xyz/b/contact-me2022-10-20T17:23:12+00:001.0https://blog.ari-web.xyz/b/working-with-paths-in-c2022-10-16T22:46:15+00:001.0https://blog.ari-web.xyz/b/happy-2nd-birthday--ari-web2022-10-16T22:03:39+00:001.0https://blog.ari-web.xyz/b/ari-web-blog-hyperlink-redesign2023-09-07T10:10:42+00:001.0https://blog.ari-web.xyz/b/my-view-on-death2022-10-02T01:32:14+00:001.0https://blog.ari-web.xyz/b/how-to-generate-a-report-for-songs-you-listen-to-using-mpv2022-09-29T03:36:15+00:001.0https://blog.ari-web.xyz/b/fuck-you--putin--you-little-bitch2022-09-26T16:05:26+00:001.0https://blog.ari-web.xyz/b/the--www--subdomain-is-no-longer-the-default-for-ari-web-xyz2022-09-25T02:21:29+00:001.0https://blog.ari-web.xyz/b/ari-web-now-delivers-minified-content2022-09-25T01:32:15+00:001.0https://blog.ari-web.xyz/b/ari-web-apis--how-to-use-them2022-09-22T22:58:42+00:001.0https://blog.ari-web.xyz/b/ari-web-apis-are-going-public2022-09-22T22:04:18+00:001.0https://blog.ari-web.xyz/b/how-to-make-your-own-gentoo-linux-overlay2022-09-22T18:44:29+00:001.0https://blog.ari-web.xyz/b/ari-web-browser-compatibility2022-09-20T01:21:45+00:001.0https://blog.ari-web.xyz/b/how-to-fix-contant-freezing-or-disconnecting-of-wpa-supplicant-wifi-on-rtl8821ce2022-09-19T18:59:08+00:001.0https://blog.ari-web.xyz/b/my-music-artist-recommendations2022-09-17T20:10:01+00:001.0https://blog.ari-web.xyz/b/sorry-for-deleting-some-blog-posts2022-09-08T13:36:50+00:001.0https://blog.ari-web.xyz/b/homework---ish-have-to-present-some-stuff-about-my-projects-and-things2022-09-08T13:21:05+00:001.0https://blog.ari-web.xyz/b/the-best-temperature-system----degrees-torture--t°-2022-09-02T16:38:46+00:001.0https://blog.ari-web.xyz/b/how-to-manually-install-alpine-linux-on-any-linux-distribution2022-08-18T22:37:59+00:001.0https://blog.ari-web.xyz/b/repl-it-billing-documentation-slightly-improved2022-08-15T23:27:27+00:001.0https://blog.ari-web.xyz/b/stop-trying-to-replace-c--2022-08-09T23:46:44+00:001.0https://blog.ari-web.xyz/b/simplicity-is-not-ease2022-08-09T22:58:56+00:001.0https://blog.ari-web.xyz/b/experiments2022-08-09T02:11:45+00:001.0https://blog.ari-web.xyz/b/discord-is-a-pure-shithole--shitcord2022-08-08T21:51:31+00:001.0https://blog.ari-web.xyz/b/i-m-leaving-collabvm2022-08-02T21:55:40+00:001.0https://blog.ari-web.xyz/b/modernism2022-07-31T18:19:27+00:001.0https://blog.ari-web.xyz/b/-aš-už-tradicinę-šeimą--movement-in-lithuania2022-07-11T19:07:50+00:001.0https://blog.ari-web.xyz/b/abot--ari-bot--bot-on-collabvm2022-07-08T03:00:16+00:001.0https://blog.ari-web.xyz/b/how-i-feel-about-rust-being-added-to-linux-kernel-version-5-202022-07-01T15:43:13+00:001.0https://blog.ari-web.xyz/b/goodbye--technoblade---2022-07-01T01:45:59+00:001.0https://blog.ari-web.xyz/b/salad-fingers2022-06-28T15:16:18+00:001.0https://blog.ari-web.xyz/b/what-kind-of-pedophilic-bullshit-is-this--freespeechtube-2022-06-28T14:36:55+00:001.0https://blog.ari-web.xyz/b/me--an-lgbt-person---anti-lgbt-family---no2022-06-28T12:46:42+00:001.0https://blog.ari-web.xyz/b/fasm----the-almost-perfect-assembler2022-06-26T02:28:39+00:001.0https://blog.ari-web.xyz/b/fuck-smokers2022-06-25T10:24:19+00:001.0https://blog.ari-web.xyz/b/restricting-contributions-on-ari-web2022-06-22T13:40:54+00:001.0https://blog.ari-web.xyz/b/being-lgbt-in-lithuania--my-expierience2022-06-16T09:58:14+00:001.0https://blog.ari-web.xyz/b/accesibility-issues-of-ari-web2022-06-14T22:28:46+00:001.0https://blog.ari-web.xyz/b/important--impersonation-of-me-on-the-internet2022-06-08T19:29:15+00:001.0https://blog.ari-web.xyz/b/stop-caring-about-the-looks2022-06-07T18:17:43+00:001.0https://blog.ari-web.xyz/b/weird-ass-day2022-06-06T18:14:39+00:001.0https://blog.ari-web.xyz/b/my-enneagram-type2022-06-05T15:44:22+00:001.0https://blog.ari-web.xyz/b/my-personality-type2022-06-05T14:54:58+00:001.0https://blog.ari-web.xyz/b/-duckduckgo--more-like-duckduckno--blog-proven2022-06-04T11:28:59+00:001.0https://blog.ari-web.xyz/b/i-got-outted-by-my-classmate--on-pride-month--fun2022-06-01T11:59:04+00:001.0https://blog.ari-web.xyz/b/pride-month-just-started-and-i-m-already-in-pain2022-06-01T10:37:56+00:001.0https://blog.ari-web.xyz/b/wtf-is-going-on-and-why-is-my-site-blowing-up2022-05-30T16:15:09+00:001.0https://blog.ari-web.xyz/b/happy--almost--pride-month---2022-05-30T12:19:42+00:001.0https://blog.ari-web.xyz/b/introducing-the-ari-web-api-2022-05-26T22:08:32+00:001.0https://blog.ari-web.xyz/b/user-opinion-and-comments-site-is-now-up---2022-05-26T19:01:41+00:001.0https://blog.ari-web.xyz/b/my-gentoo-linux-setup2022-05-25T17:15:02+00:001.0https://blog.ari-web.xyz/b/is-assembly-bloated-2022-05-21T15:25:01+00:001.0https://blog.ari-web.xyz/b/shutdown-of-my-tcl--tiny-core-linux--mirror2022-05-20T20:04:57+00:001.0https://blog.ari-web.xyz/b/how-to-print-coloured-text-in-c-and-c--2022-05-08T20:17:23+00:001.0https://blog.ari-web.xyz/b/happy-pi-e--day2022-03-14T21:02:43+00:001.0https://blog.ari-web.xyz/b/new-blog-management-system-2022-03-11T11:09:16+00:001.0 \ No newline at end of file