question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The global variable `--tw-transform` is not defined in base

See original GitHub issue

What version of Tailwind CSS are you using?

v3.0.7

What build tool (or framework if it abstracts the build tool) are you using?

tailwindcss-cli 3.0.7

What version of Node.js are you using?

v16.13.0

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction URL

https://play.tailwindcss.com/iVIJhwfSBR – Funny thing here: --tw-transform gets directly added to div:after and there is no global definition of that variable. Maybe v3.0.1 is the reason for that 😕

Describe your issue

Edit: It seems like this relates to https://github.com/tailwindlabs/tailwindcss/pull/6500

I am using web components which import a shared CSS file that only contains @tailwind base. When trying to use transform utilities I can also see transform: var(--tw-transform);.

The problem is that the variable is not defined since that does not live in Tailwind base:

*, ::before, ::after {
  ...

  --tw-transform: translateX(var(--tw-translate-x)) translateY(var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
  ...
}

Is it possible that we get this moved like the other globals like shadows or content?

*, ::before, ::after {
  --tw-ring-offset-shadow: 0 0 #0000;
  --tw-ring-shadow: 0 0 #0000;
  --tw-shadow: 0 0 #0000;
  --tw-shadow-colored: 0 0 #0000;
}
::before,
::after {
  --tw-content: '';
}

Thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Shaker-Hamdicommented, May 15, 2022

I have the same issue. I’m using Next.js, Tailwind CSS, twin.macro, and styled-components.

When applying the classes inside the styled-component Div like this, it doesn’t work (with or without the transform class) …

.div {
    ${tw`transform -translate-y-1/2`}
}

However, applying the class -translate-y-1/2 directly to the <div> element inside the component does work perfectly 😕

<div className="-translate-y-1/2">

I’m not sure if it’s a twin.macro issue in my case or is it a configuration issue or what.

1reaction
adeel-ali-atpcommented, Jan 26, 2022

In my case, @tailwind base; was not added. After adding transform started working

Read more comments on GitHub >

github_iconTop Results From Across the Web

Global variable not defined even though it appears in globals()
I just don't get why it says it's not defined if it's in globals() and have set it to global. Thanks in advance....
Read more >
Set Globals | K2View Support
Both commands can override a global value only if the global is not defined as Final. ... The PARAM_NAME must be defined as...
Read more >
Global variable is undefined at the module level
Hi, I defined a global variable in some function like this, def some_function(self): global global_var PyCharm inspection gave me,
Read more >
Scope of Variables - Julia Documentation
Scope of Variables. The scope of a variable is the region of code within which a variable is accessible. Variable scoping helps avoid...
Read more >
Share Data Between Workspaces - MATLAB & Simulink
The most secure way to extend the scope of a function variable is to use function ... from the command line and assign...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found