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

Add scripting variants #11929

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open

Conversation

lukewarlow
Copy link
Contributor

This adds two variants for the scripting media query. noscript for when JavaScript is disabled and scripting for when it's enabled.

@adamwathan
Copy link
Member

Hey thanks for this one! I do like to try and stay on the bleeding edge with what we support in Tailwind but since this isn’t even in Chromium yet I think I’d rather wait a bit longer before adding a first-class API for it and including it in the documentation.

So going to close for now but let’s revisit when browser support improves a bit?

@adamwathan adamwathan closed this Sep 6, 2023
@lukewarlow
Copy link
Contributor Author

lukewarlow commented Sep 6, 2023

Oh I should have pointed out I've just implemented this in Chrome. So it'll be in version 120. @adamwathan

@lukewarlow
Copy link
Contributor Author

lukewarlow commented Sep 6, 2023

Absolutely fine if you'd still rather wait but yeah worth being aware as of November this should be in all 3 browsers :)

@adamwathan
Copy link
Member

Alright alright, will reopen 😅 Biggest blocker on all of these PRs for what it's worth is the immense documentation effort, but going to see if someone here can make time for it next week.

@adamwathan adamwathan reopened this Sep 7, 2023
@lukewarlow
Copy link
Contributor Author

That's absolutely fine, take as long as you need!

@lukewarlow
Copy link
Contributor Author

Just as an fyi I chucked together a docs PR for the variant PRs tailwindlabs/tailwindcss.com#1674 No worries if you'd rather get someone to go through it all themselves just thought I'd give it a go in case it helped :)

@mnik01
Copy link

mnik01 commented Jan 14, 2024

In case if someone waiting this PR to be merged I've made temporary workaround based on custom media queries:

theme: {
  extend: {
    screens: {
      'noscript': { 'raw': '(scripting: none)' },
    },
  },
},

Usage:

<div class="noscript:hidden">
  Some JS dependant feature
</div>
<div class="noscript:block hidden">
  no js detected sorry :(
</div>

@lukewarlow
Copy link
Contributor Author

Alternatively https://github.com/lukewarlow/tailwind-mq includes it.

@RobinMalfait RobinMalfait changed the base branch from master to archive/master-2024-02-23 March 4, 2024 21:44
Co-authored-by: Luke Warlow <luke@warlow.dev>
@RobinMalfait RobinMalfait changed the base branch from archive/master-2024-02-23 to next April 17, 2024 21:05
@RobinMalfait RobinMalfait changed the title Add scripting variants Add scripting variants Apr 17, 2024
@RobinMalfait
Copy link
Contributor

Hey!

You might have noticed that I forced pushed to this branch. The reason is because the PR now uses next as the base branch which is our working branch for Tailwind CSS v4. In other words, the feature you implemented here is now written in the new codebase.

The code is ported as-is, so no API changes of your feature happened while moving it to the new codebase.

I also made sure to add you as a co-author because you still deserve all the credit 💪

@sdavids
Copy link

sdavids commented Apr 18, 2024

I do like to try and stay on the bleeding edge with what we support in Tailwind but [...] I rather wait a bit longer [...] let’s revisit when browser support improves a bit?

https://caniuse.com/?search=scripting

Global 81.82%

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.

None yet

5 participants