Tailwind CSS v3.0.0-alpha.1 #5668
Replies: 28 comments 38 replies
-
Why major release? I am not seeing so many changes from the latest release, so why this is not 2.3? |
Beta Was this translation helpful? Give feedback.
-
YAYYYYY!!! Congrats on this alpha release, @adamwathan and team! |
Beta Was this translation helpful? Give feedback.
-
JIT by default & first party JIT/Tailwind in the browser support ! ❤️ This isn't mentioned in the release note but is it safe to assume third party/custom plugins would also work ? <!-- Include CDN JavaScript -->
<script src="https://unpkg.com/tailwindcss-jit-cdn"></script>
<!-- Specify a custom TailwindCSS configuration -->
<script type="module" >
import tailwindcssTypography from 'https://cdn.skypack.dev/@tailwindcss/typography';
window.tailwindConfig = {
plugins: [
tailwindcssTypography,
]
};
window.tailwindCSS.refresh();
</script>
<script type="tailwind-config">
window.tailwindConfig
</script> |
Beta Was this translation helpful? Give feedback.
-
Looks awesome, but I'd highly suggest setting up versioning for the CDN build. |
Beta Was this translation helpful? Give feedback.
-
Will there be any additional features in the final v3.0.0 release? Just want to know whether I should update my downstream library or wait some more time. 😊 |
Beta Was this translation helpful? Give feedback.
-
Now my custom theme can't find |
Beta Was this translation helpful? Give feedback.
-
What about compatibility with the current Tailwind/Headless UI? |
Beta Was this translation helpful? Give feedback.
-
Why shouldn't it be used in production? |
Beta Was this translation helpful? Give feedback.
-
Congratulations on this alpha release, @adamwathan, and the team. I'd check this out while awaiting the stable release |
Beta Was this translation helpful? Give feedback.
-
Just a quick reply, I think it would be worth pinning this discussion as it kinda gets lost when viewing "all" discussions, congrats on the first v3 release, really looking forward to the new website :) |
Beta Was this translation helpful? Give feedback.
-
Congratulations on the release - looks great. With JIT now the default, do you have any plans to revisit the way you've implemented theming? (i.e. so it's possible to support more than just default and 'dark') |
Beta Was this translation helpful? Give feedback.
-
Will it be difficult to upgrade from version 2.x because of this engine default change? |
Beta Was this translation helpful? Give feedback.
-
Finally JIT by default. So excited. Waiting for |
Beta Was this translation helpful? Give feedback.
-
This is great news guys, congrats! Can't wait to see people like CodePen use the new JIT CDN feature for quick pins ;) |
Beta Was this translation helpful? Give feedback.
-
Mentioned this on the Discord but reposting it here in case it went unnoticed:
This also affects Vue CLI users, which might be worth mentioning in the release notes. Actually Vue CLI is also close (there's a beta) to releasing a new version that uses webpack 5 and supports PostCSS 8 by default, so really just changing it to say "create-react-app/vue-cli" would be accurate. |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
-
How long until you change the URL? And will |
Beta Was this translation helpful? Give feedback.
-
Great job! 🔥 I've followed the guide and upgraded, but getting this error with Vite (only when running
global.css: @import 'tailwindcss/base';
@import './partials/typography.css';
@import 'tailwindcss/components';
@import './partials/layout.css'; Same with: @tailwind base;
@tailwind components;
@tailwind utilities; tailwind.config.js: module.exports = {
content: [
'./resources/views/**/*.blade.php',
'./resources/scripts/**/*.{vue,js,ts,jsx,tsx}',
],
} Any thoughts on how to debug this? It tries to run: console.log('Potential classes: ', candidates.size)
console.log('Active contexts: ', sharedState.contextSourcesMap.size)
console.log('Content match entries', contentMatchCache.size) and outputs:
So on the last line,
All works fine if I disable debug mode or remove that line 👀 |
Beta Was this translation helpful? Give feedback.
-
Has anyone tried to use it with Jetbrains IDE's? Autocomplete is not working for me and I was wondering whether it has something to do with my config or some breaking changes which the IDE would need to fix |
Beta Was this translation helpful? Give feedback.
-
Probably a dumb question, but here goes: is it possible to use the new JIT/CDN with an external stylesheet? Basically I've got some immutable HTML in a body tag, but I can conceivably change what's going on in the head. |
Beta Was this translation helpful? Give feedback.
-
Is that possible we are stuff like Feels more readable and less typing 😄 Cannot wait for the performance improvement 👍 |
Beta Was this translation helpful? Give feedback.
-
I quickly put the JIT CDN version as a demo on codepen and it's like magic. I used the default page of https://play.tailwindcss.com. It actually is much faster (for simple pages ofc) compared to the normal CDN version. There is no need to download and parse that huge css file and instead everything gets genereated by the new ✨ bits. Link here: https://codepen.io/azunyuuuuuuu/pen/dyzpbzy |
Beta Was this translation helpful? Give feedback.
-
After replacing gray with other colors, next time when I'm commenting or removing it, it still shows the previous color (pink) instead of the default color (gray) Is this something? |
Beta Was this translation helpful? Give feedback.
-
Thank u for this great release. |
Beta Was this translation helpful? Give feedback.
-
Add a warning to remove As per my understanding, v3 uses JIT CDN by default, and a lot of folks including me are already using |
Beta Was this translation helpful? Give feedback.
-
In v2 there is an option to enable or disable purging ( |
Beta Was this translation helpful? Give feedback.
-
So... HTML-only users (no framework) can use v3-alpha??? |
Beta Was this translation helpful? Give feedback.
-
react js tailwind I did as css documentation did but it didn't work. |
Beta Was this translation helpful? Give feedback.
-
Tailwind CSS v3.0.0-alpha.1
The first alpha release of Tailwind CSS v3.0 is here! If you don't even care what's changed and just want to start using it right now, install it via npm:
If you're using @tailwindcss/typography or @tailwindcss/forms, you'll want to update those packages as well:
We've also got a brand new CDN build you can play with if you want, too.
Remember this is an alpha release, so some things might be broken. I don't know about them otherwise I would have fixed them, but you are gonna find them! So try it, break it, and tell me about it when you do so we can get this thing really battle-tested for a proper v3.0 release later this year.
What's new
greygray (#5384)aspect-ratio
utilities, using the new nativeaspect-ratio
property (#5359)accent-color
utilities, for setting the color of a form input's accent (#5387)scroll-snap
utilities, for CSS-only scroll snapping (#5637)scroll-behavior
utilities, for browser-native smooth scrolling (#5388)text-indent
utilities, for indenting the first line in a paragraph (#5449)column
andbreak-before/inside/after
utilities, for wrapping multi-column content (#5457, #5530)touch-action
utilities, for controlling touchscreen interactions (#5603)will-change
utilities, for optimizing transition performance (#5448)border-x
andborder-y
utilities, for styling left/right and top/bottom borders a the same time (#5639)file:
variant, for styling the native file upload button (#4936)open:
variant, for styling open<details>
and<dialog>
elements (#5627)What's changed
We've tried really hard to keep the breaking changes to a minimum, and this should be a really smooth upgrade — especially if you were already using the JIT engine.
Start by reading the Just-in-Time mode changes in the documentation, and then come back here for a couple more steps.
purge
has changed tocontent
The JIT engine doesn't actually use PurgeCSS under-the-hood, so
purge
doesn't feel like the right name for these configuration options anymore.Now this configuration should look like this:
For more complex configurations, it should look something like this:
We've tried really hard to make Tailwind smart enough to understand the old configuration as well, so with any luck your existing configuration should still work, but you'll want to update to the new format to silence the annoying console warnings we blast you with.
Color name changes
As part of enabling the extended color palette by default, a few color names needed to change due to collisions.
See the pull request for all of the details you need to upgrade. It should only be a couple of lines of code in your
tailwind.config.js
file.overflow-clip
has changed totext-clip
Those damn browser developers added a real
overflow: clip
property, so usingoverflow-clip
fortext-overflow: clip
is a really bad idea now.We've renamed it to
text-clip
, and nowoverflow-clip
addsoverflow: clip
like you'd expect. We've also renamedoverflow-ellipsis
totext-ellipsis
, butoverflow-ellipsis
still secretly works.PostCSS 7 is no longer supported
If you were using the
@tailwindcss/postcss7-compat
package because you are stuck on PostCSS 7, you'll need to upgrade to PostCSS 8 before you can upgrade to Tailwind CSS v3.0.0-alpha.1.I think this is mostly
create-react-app
users, and thankfully they are close to releasing a new version that uses webpack 5 and supports PostCSS 8 by default.Just-in-Time CDN
Something that has always sucked about our CDN builds is that we always had to disable tons of awesome features to keep the file size down to something the browser was willing to parse.
For Tailwind CSS v3.0, we're doing it differently. Inspired by some awesome work Marcel Pociot did on tailwindcss-jit-cdn, we've built a JS library that compiles Tailwind in the browser, and uses MutationObserver to keep track of all of the classes you're using.
It lets you use every feature Tailwind CSS has to offer, and does it in 93kB — which ain't bad for something originally designed to run in node with no file size considerations at all.
The Just-in-Time CDN is intended for development purposes only, and should not be used in production.
Why shouldn't it be used in production?
The biggest reason is because it uses MutationObserver to add the styles, it can't detect styles for dynamically created elements fast enough to avoid a flash of unstyled content (FOUC).
For example, say you have some JavaScript that opens a modal, and the modal is supposed to transition in when it opens. When the modal opens, the HTML for it is inserted into the DOM right away, but the styles might not exist for it yet because you haven't used those same classes elsewhere in the file. The observer will fire, and Tailwind will generate the styles, but the modal is already open, so you're going to see an unstyled flash the first time it opens.
We recommend pulling in the JIT CDN as a blocking (so not deferred) script to avoid the FOUC for the very initial render, but that of course means it adds 100ms (or whatever) before the page is even rendered. Not a big deal really but using a static CSS file is way faster.
It's also quite large (almost 100kB compressed) whereas compiling your CSS ahead of time usually leads to something closer to 10kb compressed, and with no run time overhead.
TLDR; It's probably fine for simple static pages but it's really much better to build the static CSS file.
To try it out, throw this
<script>
tag in your<head>
:<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Example</title> + <script src="https://cdn-tailwindcss.vercel.app/"></script> </head> <body> <!-- --> </body> </html>
We'll give it a more permanent URL in the future but this is good enough for the alpha.
Using first-party plugins
First-party plugins can be automatically loaded using the
plugins
query parameter:The
plugins
parameter accepts a comma-separated list of plugins, and you can optionally specifiy a version number or range for each plugin, for example[email protected],typography@^0.5
Customizing your config
To customize your Tailwind CSS configuration, override
tailwind.config
:Adding custom CSS
Use
<style type="text/tailwindcss">
elements to add any custom CSS that that you'd like to process with Tailwind:So there you have it! Again, this is an alpha release so there are probably going to be some issues, but play with it and report any problems you find so we can get it all cleaned up for a proper release in a month or two.
Thanks to community members @bytedance, @htunnicliff, @DoctorDerek, @lukewarlow, @codytooker, @nifte, @ericbf, @kwaa, @MatteoGauthier, @geshii, @sachinraja, @TCatinaud, @iksaku, @seanpdoyle, @95jonpet, @innocenzi, @DavydeVries, and @hardfist for your contributions to this release — lots of good ideas and improvements made it in thanks to you ❤️
This discussion was created from the release v3.0.0-alpha.1.
Beta Was this translation helpful? Give feedback.
All reactions