Skip to content
Adem Kouki
Back to blog

Removing Dark Classes from a Tailwind CSS code

Adem Kouki
1 min read
#tailwind#tricks#css

If you're using the popular CSS framework Tailwind CSS, you may have noticed that it includes a number of "dark" classes that are prefixed with dark-. These classes are designed to be used in conjunction with the @dark variant, which changes the appearance of your site when the user has chosen a "dark" theme.

While these classes can be useful in some cases, you may decide that you want to remove them from your stylesheets in order to simplify your code or to make it easier to maintain. In this post, I'll show you how you can use a regular expression (regex) to quickly and easily remove all of the dark- classes from your code.

Regex: dark:\w+([-:\w]*\w)

Or use this tool that I made: Tailwind Dark Mode Remover

Comments

Keep reading

2 min read

UnoCSS: The instant on-demand Atomic CSS engine

UnoCSS is a modern CSS engine that's designed with flexibility and performance in mind. Unlike traditional CSS frameworks, UnoCSS focuses on providing the core functionalities of…