New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Used fonts are improperly discarded #726
Comments
@GreenGremlin i don't understand you, removing |
I apologize, I should have mentioned that I'm using the postcss-discard-unused plugin specifically to remove unused css from a concatenated css file. I believe this is also possible through cssnano using the |
@GreenGremlin can you provide example or minimum reproducible test repo? |
I just created #727 to fix the issue. The code block above is a decent, minimal example. Simply processing that block of css through postcss with the postcss-discard-unused plugin enabled with the default settings will produce the bug. const rawCss = `
@font-face {
font-family: 'FontAwesome';
src: url('/fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),
url('/fonts/fontawesome-webfont.woff?v=4.7.0') format('woff');
}
.icon {
font: normal normal normal 14px/1 FontAwesome;
}
`;
const {css: processedCss} = postcss([postcssDiscardUnused]).process(rawCss);
console.assert(processedCss === rawCss);
> AssertionError [ERR_ASSERTION]: false == true
at Console.assert (console.js:194:23)
console.info(processedCss);
> .icon {
> font: normal normal normal 14px/1 FontAwesome;
> } The |
In case anyone stumbles upon this problem, may I suggest making sure that your fontawesome.css file does not have something like: i @font-face {
font-family: 'FontAwesome';
src: url('../../fonts/vendor/fontawesome-webfont.eot?v=4.1.0');
src: url('../../fonts/vendor/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'), url('../../fonts/vendor/fontawesome-webfont.woff?v=4.1.0') format('woff'), url('../../fonts/vendor/fontawesome-webfont.ttf?v=4.1.0') format('truetype'), url('../../fonts/vendor/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
} I'm talking about the extra |
This seems fixed in 5.0.0-rc.2 |
Given the following css:
...the FontAwesome @font-face definition is improperly removed. This appears to be the expected behavior, however this is valid css and should properly be detected as a use of the font. Would you be open to a PR that adds support for proper font use detection with mixed quote styles?
The text was updated successfully, but these errors were encountered: