Skip to content

Remove unused @font-face #49

Open
Open

Description

@igitur

Hi

Great tool. It works great except that it doesn't remove unused CSS items, e.g.

@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  src: local('Lato Regular'), local('Lato-Regular'), url(data:font/woff;base64,d09GR... <snip/> ...AisA) format('woff');
}

As you can see, the font data is encoded and embedded, which makes the spreadsheets massive (blame https://github.com/grammarly !).

Activity

  1. peterbe commented on Oct 16, 2017

    @peterbe
    Owner

    But if your minimal CSS needs something like body { font-family: 'Lato Regular'} how is it supposed to know what the font is?

  2. igitur commented on Oct 17, 2017

    @igitur
    Author

    Not sure I understand your question, but if the CSS needs the font, then it shouldn't be removed. Only unused fonts should be removed.

  3. peterbe commented on Oct 17, 2017

    @peterbe
    Owner

    Right, so to know the answer to that you'd need to open each selector block and look for font-family: 'Lato' right?

  4. igitur commented on Oct 17, 2017

    @igitur
    Author

    I think so. However, I don't know the CSS spec well enough to be aware of all uses of @font-face.

  5. peterbe commented on Jan 3, 2018

    @peterbe
    Owner

    My new Node based tool (will soon) support this: peterbe/minimalcss#55
    It's also based on a proper CSS parser whereas mincss depends on regular expressions.

  6. igitur commented on Feb 8, 2018

    @igitur
    Author

    Am I right that this should be fixed by peterbe/minimalcss@5672b7b ?

  7. peterbe commented on Feb 8, 2018

    @peterbe
    Owner

    @igitur indeed!

  8. igitur commented on Feb 8, 2018

    @igitur
    Author

    Sidenote, how do I get mincss to print its version? One would expect something like mincss --version.

  9. peterbe commented on Feb 8, 2018

    @peterbe
    Owner

    Yeah, I would expect that too :)
    Maybe next time 715a48f

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