Tailwindcss-module: Tailwind is not purging unused styles because no template paths have been provided.

Created on 20 May 2020  ·  8Comments  ·  Source: nuxt-community/tailwindcss-module

Hi,

When building my nuxt 2.12.2 project, I am getting this warning:

Tailwind is not purging unused styles because no template paths have been provided.

But the css does seem to be purged, I think? Any clues?

question wontfix

Most helpful comment

I've now seen that @Atinux put the recommended settings on the new tailwind.config.js
The problem is it didn't update for current projects.
The recommended settings he put are:

// tailwind.config.js
module.exports = {
  /* ... your actual config */,
  purge: {
    // Learn more on https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css
    enabled: process.env.NODE_ENV === 'production',
    content: [
      'components/**/*.vue',
      'layouts/**/*.vue',
      'pages/**/*.vue',
      'plugins/**/*.js',
      'nuxt.config.js'
    ]
  }
}

All 8 comments

Yep, It isn't by default.
Proper in my case:

module.exports = {
  purge: [
    "./pages/**/*.vue", 
    "./components/**/*.vue", 
    "./plugins/**/*.vue",
    "./static/**/*.vue",
    "./store/**/*.vue"
  ],
  theme: {},
  variants: {},
  plugins: []
};

It happened to me too, worked with the @Triloworld solution. But I think it should be added by default!!

@Triloworld's solution seems to work well! Thanks!

I've now seen that @Atinux put the recommended settings on the new tailwind.config.js
The problem is it didn't update for current projects.
The recommended settings he put are:

// tailwind.config.js
module.exports = {
  /* ... your actual config */,
  purge: {
    // Learn more on https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css
    enabled: process.env.NODE_ENV === 'production',
    content: [
      'components/**/*.vue',
      'layouts/**/*.vue',
      'pages/**/*.vue',
      'plugins/**/*.js',
      'nuxt.config.js'
    ]
  }
}

Thanks @santicros, your config help me a lot. When I build or generate with the @Triloworld solution, the breakpoints like md:* don't appears on compiled files.

@dbarjs running into the same issue on my end with md:* . Disabled purge on tailwind.config.js and nuxt.config.js

I don't think this module should require having to add in a production flag for enabled.

According to the Tailwind docs, purge should only run in production and they are explicit that enabled is a manual override. So this module should not default to requiring a manual override.

image

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joffreyBerrier picture joffreyBerrier  ·  8Comments

sausin picture sausin  ·  4Comments

michaelpumo picture michaelpumo  ·  3Comments

webcoderkz picture webcoderkz  ·  9Comments

foxted picture foxted  ·  8Comments