Search code examples
angularcypresstailwind-csscypress-component-test-runner

Angular Cypress Component tests not working with Tailwindcss


When running Tailwindcss in an Nx style monorepo (apps and libs folders) I have setup the Tailwind config as:

content: ['./apps/**/*.{html,ts}', './libs/**/*.{html,ts}'],

But it is not applying any Tailwindstyles and gives the error:

"warn - No utility classes were detected in your source files. If this is unexpected, double-check the content option in your Tailwind CSS configuration."

And no styling is applyed to the component tests.

I tried to change the content in the tailwind.config.js to:

content: ['/**/*.{html,ts}', '**/*.{html,ts}'],

Which works but makes tailwind execution slow as it will also evaluate node_modules.


Solution

  • It worked by adding:

    './src/**/*.{html,ts}'
    

    To the tailwind.config.js's content:

    content: ['./apps/**/*.{html,ts}', './libs/**/*.{html,ts}', './src/**/*.{html,ts}'],