8000 Document how you're supposed to use minimalcss · Issue #93 · peterbe/minimalcss · GitHub
[go: up one dir, main page]

Skip to content

Document how you're supposed to use minimalcss #93

Open

Description

@peterbe

Generally the idea is that you replace your bloated external style sheets with one block of minimal CSS. That can either be injected as a new external .css or inlined. But it's generally a good idea to do something like this:

Before:

<link rel="stylesheet" href="bloatedframework.css">

After:

<link rel="stylesheet" href="builds/minimal.css">
<link rel="preload" href="bloatedframework.css" as="style" onload="this.rel='stylesheet'">

The reason why it's a good idea to still lazy load in that bloatedframework.css is because minimalcss can only figure out the minimal CSS on first page load (including XHR) before the user starts interacting and using the pointer to cause the DOM to change.

All of that needs to be explained! Ideally quite early in the README to grab peoples attention.

Also, it should probably link to loadCSS which has a good polyfill solution to lazy loading CSS. The code example above doesn't work in all browsers.

Activity

  1. peterbe commented on Jan 23, 2018

    @peterbe
    OwnerAuthor

    Bonus points if we can have some gh-pages examples that demonstrate this with URLs you can throw into webpagetest.

  2. stereobooster commented on Jan 23, 2018

    @stereobooster
    Collaborator

    Do not forget

    <noscript>
      <link rel="stylesheet" href="bloatedframework.css">
    </noscript>
  3. peterbe commented on Jan 23, 2018

    @peterbe
    OwnerAuthor

    Yep, I think that's part of the loadCSS solution. It's what I use on https://songsear.ch

  4. stereobooster commented on Jan 23, 2018

    @stereobooster
    Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0