Skip to content
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

SX: Vendor prefixes via Autoprefixer #1467

Closed
wants to merge 1 commit into from
Closed

Conversation

michalsanger
Copy link
Contributor

Vendor prefixes are automatically added into the generated CSS.

@tbergquist-godaddy
Copy link
Contributor

Does it work with runtime styles as well?

@vercel vercel bot temporarily deployed to Preview – universe-example-relay December 6, 2020 12:23 Inactive
@vercel vercel bot temporarily deployed to Preview – universe-sx-tailwind-website December 6, 2020 12:23 Inactive
@@ -14,11 +14,13 @@
"@adeira/murmur-hash": "^1.0.0",
"@adeira/signed-source": "^1.0.0",
"@babel/runtime": "^7.12.5",
"autoprefixer": "^10.0.4",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be a part of the runtime-bundle? because it is quite huge

https://bundlephobia.com/[email protected]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@tbergquist-godaddy tbergquist-godaddy Dec 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is production build of relay-example in this branch:

Screenshot 2020-12-06 at 14 52 35

Copy link
Contributor

@tbergquist-godaddy tbergquist-godaddy Dec 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is master:

Screenshot 2020-12-06 at 14 54 54

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is true that during a build of sx-tailwind-website in the monorepo I get warnings and increased bundle size:

/Users/michalsanger/projects/adeira/universe/node_modules/@adeira/sx/node_modules/browserslist/node.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

/Users/michalsanger/projects/adeira/universe/node_modules/@adeira/sx/node_modules/browserslist/node.js 175:18-177:7
Critical dependency: the request of a dependency is an expression

But when I tried postcss and autoprefixer on a standalone Next.js project everything was fine. Maybe because of next.config.js?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is there some cheaper alternative for CSS-in-JS? 1 MB is really a lot. Why is it so big? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the PostCSS is designed to be used with Babel & Webpack, not during a runtime. I'll try to use https://github.com/robinweser/inline-style-prefixer in a new PR but probably the output will not be that good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most CSS-in-JS uses styleis

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, you could read it from mdn/browser-compat-data as suggested here: #996

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attempt with Stylis #1480

"change-case": "^4.1.2",
"css-tree": "^1.1.2",
"fast-levenshtein": "^3.0.0",
"json-stable-stringify": "^1.0.1",
"mdn-data": "^2.0.14",
"postcss": "^8.1.14",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also adds about 60kb

@vercel vercel bot temporarily deployed to Preview – universe-sx-tailwind-website December 6, 2020 13:24 Inactive
@vercel vercel bot temporarily deployed to Preview – universe-example-relay December 6, 2020 13:24 Inactive
Vendor prefixes are automatically added into the generated CSS.
@vercel vercel bot temporarily deployed to Preview – universe-sx-tailwind-website December 6, 2020 15:15 Inactive
@vercel vercel bot temporarily deployed to Preview – universe-example-relay December 6, 2020 15:15 Inactive
@michalsanger
Copy link
Contributor Author

See #1480

@mrtnzlml
Copy link
Member

mrtnzlml commented Dec 9, 2020

@michalsanger So this branch can be deleted? 🙂

@michalsanger michalsanger deleted the sx-autoprefixer branch December 9, 2020 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants