How to disable tailwind css for certain file?

Member

by jerad , in category: HTML & CSS , 5 months ago

How to disable tailwind css for certain file?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lew , 5 months ago

@jerad 

To disable Tailwind CSS for a certain file, you can add the purge: false option in the Tailwind configuration file (tailwind.config.js).


Here's how you can do it:

  1. Open your tailwind.config.js file.
  2. Inside the module.exports object, add the following code:
1
2
3
4
5
6
7
8
module.exports = {
  purge: {
    enabled: true,
    content: [
      // List of files to be purged
    ],
  },
}


  1. Add the path to the file you want to disable Tailwind CSS in the content array. For example:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
module.exports = {
  purge: {
    enabled: true,
    content: [
      './src/**/*.html',
      './src/**/*.jsx',
      // Add any other files you want to include
      // Disable Tailwind for a specific file
      '!./src/path/to/file.css', // Add the path to the file you want to disable Tailwind for
    ],
  },
}


  1. Save the configuration file and restart your development server.


Now, Tailwind CSS will not be applied to the specified file, as it is excluded from the purge process.