Comments (6)
@leo-cheron Tailwindcss by default generates 1 CSS file, as mentioned by @nhducit!
I guess I'll have to combine it with modules to manually split some heavy chunks.
from next.js.
This is how Tailwind works. You will get the same result with SolidStart, Svelte Kit, or Nuxt.
Next.js cannot do anything here.
from next.js.
For MS Teams Microsoft used auto generated atomic styles (so basically similar to tailwind but auto generated) from their code resulting in a 1 MB .css file:
mui/material-ui#38137 (comment)
Why it matters? In a large application, you must preload CSS for the entire app. You can't load something later without incurring a performance hit.
from next.js.
@leo-cheron Tailwindcss by default generates 1 CSS file, as mentioned by @nhducit!
from next.js.
I would be very interested in a benchmark on the cost of not having code spitting for Tailwind CSS. There seems to be a cost:
- React tech lead encourages to code split Tailwind CSS: reactwg/react-18#108
If you extract everything into literally a single CSS file for your whole site you might get away with just putting a
<link>
reactwg/react-18#106 and call it a day. That might not be such a bad idea for many small sites that use atomic CSS or reusable rules like tailwind. Those tend to plateau in their size growth.However, even in those systems you eventually tend to grow out of them and loading all CSS up front becomes a bad idea. In those cases you want to inject CSS files based on if they're used by the components you're rendering on the server.
- https://youtu.be/nWcexTnvIKI?si=2Yea9mRcgVtMY19i&t=1312 unused CSS has a one-time network work, a one-time CSS parsing cost, and an ongoing style resolution runtime cost, each time a change in the DOM happens.
from next.js.
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
from next.js.
Related Issues (20)
- RSC request prevent on prefetch false HOT 3
- Document not defined, NextJS cant throw traces HOT 1
- Global error not working if triggered in sub-path in version 13.5.5 HOT 2
- Wrong generated favico metada links HOT 1
- notFound() does not replace robots tag HOT 1
- Web workers do not work when runtime is edge HOT 5
- Google Analytics package in @next/third-parties/google doesn't track data if multiple GA4 streams are added HOT 1
- Docs: `pages/optimizePackageImports` points at `compress` instead HOT 3
- Loading.tsx files dont works with nested routes HOT 2
- Unable to Fetch Data from Backend Server in Next.js SSR Production with Docker HOT 5
- with-next-translate example broken (html, body missing in layout; 404 pages)
- Stale search parameters when using an anchor/fragment in the `as` property of `Link`
- Docs: 在next14.2.5版本中,怎么监听路由的的变化 HOT 1
- Response.redirect with relative URLs not working for Route Handlers HOT 1
- Error: Automatic publicPath is not supported in this browser
- Form error with server action on route change HOT 5
- Gravatar Error On Build HOT 2
- [Turbopack] [Dev] Error: Could not parse module '/app-router-context.js' with `next-auth` HOT 6
- Docs: Missing Instructions for Configuring next.config.mjs to Use next/mdx Package HOT 2
- Error instance not preserved in `onRequestError` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next.js.