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.

Disabling textOpacity/backgroundOpacity should remove the variables similar to tailwind's output

See original GitHub issue

In Tailwind, disabling the text and background opacity would remove the variables but this is not the case for twin.macro.

// tailwind.css (original)
.bg-red-400 {
  --bg-opacity: 1;
  background-color: #fc8181;
  background-color: rgba(252, 129, 129, var(--bg-opacity));
}

// tailwind.config.js
  corePlugins: {
    textOpacity: false,
    backgroundOpacity: false,
  },

// tailwind.css (with above settings)
.bg-red-400 {
  background-color: #fc8181;
}

// twin.macro
console.log(tw`bg-red-400`) // { --bg-opacity: "1", backgroundColor: "rgba(252, 129, 129, var(--bg-opacity))"}

this is adding some unnecessary overhead, in my case i’m using twin.macro to animate object properties so I would prefer to only manipulate the background or color properties(as it should).

_Originally posted by @cybervaldez in https://github.com/ben-rogerson/twin.macro/issues/86#issuecomment-707237243_

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ben-rogersoncommented, Oct 28, 2020

The feature is now in v1.12.0 🎉

0reactions
ben-rogersoncommented, Oct 22, 2020

@cybervaldez @r0skar Could you please check my PR and see if this covers your use-cases?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimizing for Production - Tailwind CSS
Tailwind CSS is incredibly performance focused and aims to produce the smallest CSS file possible by only generating the CSS you are actually...
Read more >
[JIT] Disabling opacity core plugins doesn't change output of ...
I am able to use Tailwind 2 with the opacity utils disabled (and avoiding a few other utils that use CSS variables), but...
Read more >
How to remove unnecessary css when it compiled to output in ...
Just disable Preflight // tailwind.config.js module.exports = { .... corePlugins: { preflight: false, } }.
Read more >
Why I Don't Like Tailwind CSS | Aleksandr Hovhannisyan
According to this paradigm, your class names should be as granular as possible, responsible for one main task. These utility classes serve as ......
Read more >
Disabling the Tailwind input ring - Roman Sorin
If you've ever worked with Tailwind, you've probably come across an input ring – but it isn't always clear on how to remove...
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