Skip to content

Stop polyfilling CSS variables in GENERIC builds #12933

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

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

At this point in time, all browsers that we support have native support for CSS variables; please see https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties#browser_compatibility and

pdf.js/gulpfile.js

Lines 79 to 91 in 9af8501

// Default Autoprefixer config used for generic, components, minified-pre
var AUTOPREFIXER_CONFIG = {
overrideBrowserslist: [
"last 2 versions",
"Chrome >= 49", // Last supported on Windows XP
"Firefox >= 52", // Last supported on Windows XP
"Firefox ESR",
"Safari >= 10",
"> 0.5%",
"not IE > 0",
"not dead",
],
};

This reduces the size of the built viewer.css file, in GENERIC builds, from 93 814 to 55 285 bytes (~41 percent).

At this point in time, all browsers that we support have native support for CSS variables; please see https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties#browser_compatibility and https://github.com/mozilla/pdf.js/blob/9af8501e6c44eb32bea905c3b56b4c1e6c5f5ba5/gulpfile.js#L79-L91

This reduces the size of the *built* `viewer.css` file, in GENERIC builds, from `93 814` to `55 285` bytes (~41 percent).
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/37329c6f6939c4b/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/37329c6f6939c4b/output.txt

Total script time: 4.31 mins

Published

@timvandermeij timvandermeij merged commit 59f938d into mozilla:master Jan 30, 2021
@timvandermeij
Copy link
Contributor

Nice, that's a pretty significant reduction!

@Snuffleupagus Snuffleupagus deleted the rm-CSS-variables-polyfill branch January 30, 2021 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants