tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

TailwindCSS - Purge Keyframes not supported

Open samtrion opened this issue 5 years ago • 4 comments

When we use the following tailwind.config.js, no keyframes are removed...

module.exports = {
    purge: {
        enabled: true,
        keyframes: true,
        content: ["./**/*.cshtml", "./**/*.html", "./**/*.razor"]
    }
};

If we use the same configuration within postcss.config.js for purgecss, the keyframes are removed, but so are all the html tags.

{
  // Unnecessary information removed
  "devDependencies": {
    "autoprefixer": "^10.1.0",
    "gulp": "^4.0.2",
    "gulp-cli": "^2.3.0",
    "gulp-clone": "^2.0.1",
    "gulp-cssnano": "^2.1.3",
    "gulp-notify": "^3.2.0",
    "gulp-plumber": "^1.2.1",
    "gulp-postcss": "^9.0.0",
    "gulp-rename": "^2.0.0",
    "gulp-sourcemaps": "^3.0.0",
    "merge-stream": "^2.0.0",
    "postcss-focus": "^5.0.1",
    "postcss-import": "^14.0.0",
    "postcss-mixins": "^7.0.2",
    "postcss-sort-media-queries": "^2.3.17",
    "precss": "^4.0.0",
    "purgecss": "^3.1.3",
    "tailwindcss": "^2.0.2"
  },
  "peerDependencies": {
    "postcss": "^8.2.2"
  }
}

samtrion avatar Dec 31 '20 12:12 samtrion

Hey! Your configuration is close but a tiny bit incorrect, needs to look like this:

module.exports = {
    purge: {
        enabled: true,
        content: ["./**/*.cshtml", "./**/*.html", "./**/*.razor"],
        options: {
          keyframes: true,
        }
    }
};

Top-level options under "purge" are Tailwind's purge API, and any raw options you want to pass directly to PurgeCSS have to go under options 👍 Hope that helps!

adamwathan avatar Dec 31 '20 12:12 adamwathan

Oh man, found the documentation about this.

Can you possibly expand the example here to make it a little more obvious? A bit annoying because we have about 20 keyframes grinding along all the time.

samtrion avatar Dec 31 '20 12:12 samtrion

Added a few more examples to hopefully make it more obvious, will be live after the deploy it done:

image

adamwathan avatar Dec 31 '20 13:12 adamwathan

Hey! Your configuration is close but a tiny bit incorrect, needs to look like this:

module.exports = {
    purge: {
        enabled: true,
        content: ["./**/*.cshtml", "./**/*.html", "./**/*.razor"],
        options: {
          keyframes: true,
        }
    }
};

Top-level options under "purge" are Tailwind's purge API, and any raw options you want to pass directly to PurgeCSS have to go under options 👍 Hope that helps!

Options for purge removed in version 3 and Keyframes not purged. What is the solution in this version?

h7arash avatar Dec 13 '21 15:12 h7arash