Skip to content

Try to put size of (uncompressed) CSS back under 50 kB #66

@mosra

Description

@mosra

Google's AMP dictates that CSS stylesheets should be no larger than 50 kB (along with other requirements such as having everything inline and/or async loaded using JS, which doesn't apply here). I think that could be a good thing to try to achieve here as well -- while the compressed version is now at ~10.0 kB, the uncompressed one is ~70 kB.

Most responsible for this growth are the recent plugin additions (plots and graphs), which add a lot of extra SVG styling. What could be done:

  • Improve the postprocess.py script to reduce file size even more (no indentation at all? no newlines?)
  • Manually compress the CSS (use a single margin property instead of separate margin-top, margin-bottom etc.)
  • Reduce the amount of repeated lists of long selectors with a single selector containing more properties (e.g., repeating color: #ff3366 five times is better than repeating table.m-table tr.m-danger td a:hover five times)
  • Port to the native CSS grids (CSS Grids #31), which could make the majority of m-grid.css obsolete (it's 13 kB now)
  • Use the :is() selector (Rewrite many selectors with :is() to reduce size #208)

Any further ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedSuitable for a community contribution.

    Projects

    Status

    TODO

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions