Is there a way to avoid purging a specific library with Tailwind?

Viewed 462

I have this on my tailwind config:

purge: {
  content: ['./src/**/*.css', './src/**/*.tsx', './src/**/*.js'],
  safelist: ['animate-spin'],
},

Had to add "animate-spin" to the safelist because it was getting purged. This class is only being used on a component library, but I'm seeing that there are still some classes missing.

The problem is that I don't want to add one by one all the classes missing, is there a way to add an entire library to the safelist?

1 Answers

To fix it had to add the library path to the "content" list:

content: ['./src//*.css','./src//.tsx','./src/**/.js',
          './node_modules/@mylib//*.css','./node_modules/@mylib//.tsx',
          './node_modules/@mylib/**/.js',],
Related