Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Tailwind v1.4 which bakes-in Purge CSS support #3

Open
deadcoder0904 opened this issue May 1, 2020 · 2 comments
Open

Update to Tailwind v1.4 which bakes-in Purge CSS support #3

deadcoder0904 opened this issue May 1, 2020 · 2 comments

Comments

@deadcoder0904
Copy link

Thank you for https://statickit.com/guides/next-js-tailwind

I followed it many times. Tried updating but Purge CSS deletes my CSS. Mind updating the guide?

@deadcoder0904
Copy link
Author

Found the solution 🎉

Some changes required in the guide:

2. Install dependencies

Don't need to add @fullhuman/postcss-purgecss

npm install tailwindcss autoprefixer --save-dev

3. Configure the build pipeline

It becomes

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {}
  }
}

6. Generate tailwind.config.js & add purge property

module.exports = {
  purge: {
    content: ['./components/**/*.js', './pages/**/*.js'],
    options: {
      whitelist: ['text-pink-500', 'text-yellow-500'], // anything that needs to be whitelisted
    },
  },
  theme: {
    extend: {},
  },
  variants: {},
  plugins: [],
}

Reference: tailwindlabs/tailwindcss#1639

@jonrh
Copy link

jonrh commented Jul 16, 2020

Thanks @deadcoder0904, worked like a charm! At the time of writing I had no need for whitelisting so the following minimal config was enough:

tailwind.config.js

module.exports = {
  purge: {
    content: ['./components/**/*.js', './pages/**/*.js'],
  }
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants