Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Pagespeed eats CSS font-face declarations when defined in imported files #1222

Description

@rbu

Given the following configuration:

    pagespeed RewriteLevel CoreFilters;
    pagespeed EnableFilters combine_css,combine_javascript;
    pagespeed EnableFilters rewrite_javascript,rewrite_css,fallback_rewrite_css_urls;
    pagespeed EnableFilters move_css_above_scripts,move_css_to_head,collapse_whitespace;

And the following files:
test.html:

<html>
    <head>
        <meta charset="utf-8" />
        <link rel="stylesheet" href="main.css">
    </head>
    <body>
        content
    </body>
</html>

main.css:

@import url('sub.css');
.after-import {
    font-family: "myfont";
    display: none;
}

sub.css:

.before-font {
    display: none;
}
@font-face {
    font-family: 'myfont';
}
.after-font {
    display: none;
}

nginx pagespeed yields:

<html>
<head>
<meta charset="utf-8"/>
<style>.before-font{display:none}.after-font{display:none}.after-import{font-family:"myfont";display:none}</style>
</head>
<body>
content
</body>
</html>

Note that this is missing the @font-face declaration. This example is minified. The @font-face actually contains source identifiers and the like. The main css file is longer (so it is not inlined), however the same issue happens. The URLs are retrievable, it works on the first load after a cache flush (before minification) and when pagespeed is disabled via the URL.

No activity

Activity on this issue will appear here.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions