Table of contents
May 16, 2020 · View on GitHub
Table of contents
Upgrading to v3.0.0 from v2.x
Additionally to these changes, some features have been added, such as a built-in variant plugin. Make sure to read the new documentation to fully understand how to use the new configuration.
Plugin declaration
Previously, you had to directly import your configuration file. Now, you need to import the actual module, tailwindcss-theming. It will look for a theme.config.js at the root of your project. For more information, see how to change the theme file.
// tailwind.config.js
module.exports = {
theme: {},
variants: {},
plugins: [
- require('./theme.config.js')
+ require('tailwindcss-theming')
],
};
Import
A ThemeBuilder and a Theme object had to be imported from tailwindcss-theming. The new builder object is called ThemeManager, and you need to import it from tailwindcss-theming/api.
// theme.config.js
- const { ThemeBuilder, Theme } = require('tailwindcss-theming');
+ const { ThemeManager, Theme } = require('tailwindcss-theming/api');
Theme API changes
name()is nowsetName()assignable()is nowtargetable()colors()is nowaddColors()and supports Tailwind's nested color syntaxopacityVariant()is nowsetOpacityVariant()colorVariant()is nowsetColorVariant()variable()is nowsetVariable()
More informations about the new configuration on the themes documentation.
ThemeBuilder API changes
ThemeBuilderis nowThemeManagerThemeBuilderis nowThemeManagerdefaultis nowsetDefaultThemelight()is has been removeddark()is has been removedsetDefaultLightTheme()theme has been addedsetDefaultDarkTheme()theme has been addedtheme()is nowaddTheme()addLightTheme()theme has been addedaddDarkTheme()theme has been addedprefix()is nowsetPrefix()asDataThemeAttribute()is nowasDataThemeAttributes()asDataAttribute()is nowasDataAttributes()asPrefixedAttribute()is nowasPrefixedAttributes()asClass()is nowasClasses()asPrefixedClass()is nowasPrefixedClasses()
More informations about the new configuration on the themes documentation.