Option to minify css selector names

This is mostly related to code highlighting, but can be generalized to all code.
For example, in Jekyll the code highlighting css has selectors like
.ha, .hb. In Zola they’re more verbose (z-function-call), and this implies bigger page size (I measured a 50+kb overhead for one of my articles).

The suggestion is to add an option which would

  1. Scan html templates to get classes and ids.
  2. Scan Sass/SCSS files to get classes, ids, and variables.
  3. Replace the selectors with minified auto-generated names.

That’s not going to be an issue anymore after Investigate tree-sitter to replace syntect · Issue #1787 · getzola/zola · GitHub so I wouldn’t bother implement anything.
The issue above is blocked on tree-sitter releasing a version with support for pre-compiled things which is in the roadmap. The actual highlighter code is already mostly written. If it takes too long we might use a fork but we’re not in a hurry

2 Likes