DEV Community

Discussion on: A nextjs template with typescript, tailwindcss and storybook support 🏗

Collapse
 
bhatvikrant profile image
Vikrant Bhat

Hey! This is a great template!
How did you purge css for this?

Collapse
 
raphaelmansuy profile image
Raphael MANSUY

Hi Vikrant.

I use PostCSS.

This is defined in the file tailwind.config.js. CSS is purged only for production.

const purgeEnabled = process.env.NODE_ENV === "production"

console.log("\n")
console.log(`   TailwindCSS \n`)
console.log(`   ----------- \n`)
console.log(`   ✅ purgeEnabled=${purgeEnabled}\n`)

module.exports = {
  purge: {
    enabled: purgeEnabled,
    content: ["./src/**/*.html", "./src/**/*.tsx", "./src/**/*.jsx"]
  },
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {}
  },
  variants: {
    extend: {}
  },
  plugins: []
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
bhatvikrant profile image
Vikrant Bhat

I see, actually I am using bootstrap in my own project, do you by any chance have an idea how the same can be done with bootstrap?

Hehe, I'm just getting my hands dirty with Nextjs! It's amazing.

Thread Thread
 
raphaelmansuy profile image
Raphael MANSUY

For Boostrap the best option is to use PurgeCSS npmjs.com/package/purgecss

Thread Thread
 
raphaelmansuy profile image
Raphael MANSUY
Thread Thread
 
bhatvikrant profile image
Vikrant Bhat

Got it! Thankyou so much. Really appreciate the help 😇

Thread Thread
 
raphaelmansuy profile image
Raphael MANSUY

Your are welcome