DEV Community

Ansh Sheladiya
Ansh Sheladiya

Posted on

The Config File Of Tailwind CSS

module.exports = {
  // Paths to scan for classes to purge unused styles in production builds
  purge: ['./src/**/*.html', './src/**/*.js'],

  // Configuration for dark mode
  darkMode: 'class', // 'class' will enable dark mode by adding a class to the <body>, can also be 'media' or 'false'

  // Theme customization
  theme: {
    extend: {
      // Extend default color palette with custom colors
      colors: {
        primary: '#FF0000',
        secondary: '#00FF00',
      },
      // Extend default font family with custom fonts
      fontFamily: {
        sans: ['Roboto', 'sans-serif'],
      },
    },
  },

  // Variants customization
  variants: {
    extend: {
      // Extend variants for backgroundColor utility class to include responsive, hover, focus, and active states
      backgroundColor: ['responsive', 'hover', 'focus', 'active'],
    },
  },

  // Additional plugins to enhance Tailwind's functionality
  plugins: [
    require('@tailwindcss/forms'), // Plugin for styling form elements
    require('@tailwindcss/typography'), // Plugin for styling typography
  ],
}

Enter fullscreen mode Exit fullscreen mode

Top comments (0)