1const defaultTheme = require('tailwindcss/defaultTheme');
 2const colors = require('tailwindcss/colors')
 3
 4
 5/** @type {import('tailwindcss').Config} */
 6module.exports = {
 7    content: [
 8        './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
 9        './vendor/laravel/jetstream/**/*.blade.php',
10        './storage/framework/views/*.php',
11        './resources/views/**/*.blade.php',
12        './vendor/filament/**/*.blade.php',
13    ],
14
15    theme: {
16        extend: {
17            fontFamily: {
18                sans: ['Nunito', ...defaultTheme.fontFamily.sans],
19            },
20            colors: {
21                primary: colors.green,
22                danger: colors.rose,
23                success: colors.green,
24                warning: colors.yellow,
25            }
26        },
27    },
28
29    plugins: [
30        require('@tailwindcss/forms'),
31        require('@tailwindcss/typography')
32    ],
33};

Tailwind.config.js Documentation 📚

This documentation provides an overview of the tailwind.config.js file, which is used to configure the Tailwind CSS framework for your project. This file demonstrates how to extend the default theme, add custom colors, and include plugins.

Content 📄

The content array specifies the file paths where the markup using Tailwind CSS classes is located. This allows Tailwind to remove any unused styles and optimize the file size.

 1content: [
 2    './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
 3    './vendor/laravel/jetstream/**/*.blade.php',
 4    './storage/framework/views/*.php',
 5    './resources/views/**/*.blade.php',
 6    './vendor/filament/**/*.blade.php',
 7],

Theme 🎨

The theme object is used to extend the default theme configurations. You can override or extend the default styling options provided by Tailwind CSS.

Extending the Font Family ✍️

The fontFamily object is used to override the default sans-serif font family. Here, 'Nunito' font is added to the sans list:

 1fontFamily: {
 2    sans: ['Nunito', ...defaultTheme.fontFamily.sans],
 3},

Custom Colors 🌈

The colors object is used to customize the colors available in the Tailwind CSS framework. In this example, four colors are being defined with their respective names:

Name Color
primary colors.green
danger colors.rose
success colors.green
warning colors.yellow
 1colors: {
 2    primary: colors.green,
 3    danger: colors.rose,
 4    success: colors.green,
 5    warning: colors.yellow,
 6}

Plugins 🔌

The plugins array is used to include additional plugins to Tailwind CSS. In this example, the following plugins are included:

  1. @tailwindcss/forms: A plugin that provides form control styling.
  2. @tailwindcss/typography: A plugin that provides out-of-the-box typography styles and utilities.
 1plugins: [
 2    require('@tailwindcss/forms'),
 3    require('@tailwindcss/typography')
 4],