Is there any function to remove all of the tailwind css classes remove from NextJs app?

Freelancer BJR

We are in big project like amazon. So,two branches use bootstrap 4. Now in main branch we are install tailwind css and i also added content path in tailwind.config.js. it's work perfectly... But the problem is now getting some overwritten bootstrap by the tailwind classes... When i remove @tailwind base, components, utilities from the global.css then bootstrap work fine. But after added those line then again bootstrap not working and it's come some tailwind classes.

So, now how can i fix it?

Sean W

You can prefix all tailwind CSS classes to remove naming conflicts.

tailwind.config.js

module.exports = {
  prefix: 'tw-',
}

You will need to update your classes in your codebase to reflect the prefix.

For example - <div className="flex"> would now be <div className="tw-flex">

Prefixes are only added to default tailwind classes. You need to manually prefix any custom classes or change their names to prevent conflicts with other frameworks.


Tailwind has some base styles that you can omit by disabling preflight.

tailwind.config.js

corePlugins: {
  preflight: false,
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related