---
title: "Discussion on \"Speedy and Stylish - How to style NextJS with Bootstrap 5, SASS, and PurgeCSS\" | Hashnode"
description: "Discussion on \"Speedy and Stylish - How to style NextJS with Bootstrap 5, SASS, and PurgeCSS\". A quick and easy how-to for styling Next apps in 2021"
url: "https://hashnode.com/posts/style-nextjs-with-bootstrap-5-sass-and-purgecss/60c1f9cb18e6d852c62ee73a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Speedy and Stylish - How to style NextJS with Bootstrap 5, SASS, and PurgeCSS](https://blog.zack.computer/style-nextjs-with-bootstrap-5-sass-and-purgecss?utm_source=hashnode&utm_medium=feed)

A quick and easy how-to for styling Next apps in 2021

Jun 10, 2021 · 5 min read · blog.zack.computer  
Read the article

-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#howtos](https://hashnode.com/tag/howtos)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#bootstrap](https://hashnode.com/tag/bootstrap)
-   [#frontend-development](https://hashnode.com/tag/frontend-development)

## Written by

[Zack Sheppard](https://hashnode.com/@zackdotcomputer)

@zackdotcomputer · London, UK

  
[View profile](https://hashnode.com/@zackdotcomputer)

iOS / Server / Web developer

Currently: I'm a frontend dev and product maker working for myself and freelance clients from my office in London. Previously I could be found: flying around the globe in 80 days, working 7 years at Foursquare, including managing their apps teams, and scraping together a classic New York life as an actor/bartender.

## Responses 3

Markdown supported · ⌘↵ to post

[Dietrich Wallmann](https://hashnode.com/@soldi)

[Sep 18, 2021](https://hashnode.com/posts/style-nextjs-with-bootstrap-5-sass-and-purgecss/60c1f9cb18e6d852c62ee73a/comment/6145d0aca2b54e17a52c235b)

Hi, thanks for your article on how to include sass and bootstrap into a next.js project. As for the caveat, you can evaluate the _process.env.NODE\_ENV_ variable and add the purgecss setting block only in the production environment. For more, see the next.js docs: [Customizing Plugins](https://nextjs.org/docs/advanced-features/customizing-postcss-config#customizing-plugins) . Here is my postcss.config.js file:

```
module.exports = {
  plugins: [
    'postcss-flexbugs-fixes',
    [
      'postcss-preset-env',
      {
        autoprefixer: {flexbox: 'no-2009'},
        stage: 3,
        features: {'custom-properties': false},
      },
    ],
  ],
};

if (process.env.NODE_ENV === 'production') {
  module.exports.plugins.push([
    '@fullhuman/postcss-purgecss',
    {
      content: ['./src/**/*.{js,jsx,ts,tsx}', './pages/**/*.{js,jsx,ts,tsx}'],
      defaultExtractor: (content) => content.match(/[\w-/:]+(?<!:)/g) || [],
      safelist: ['html', 'body'],
    },
  ]);
}
```

In my still empty project that includes bootstrap, I could decrease the size of the .next folder from 6.6 MB to 5.2MB using purgecss in the production build.

[Javaid Naik](https://hashnode.com/@javaid)

[Aug 20, 2021](https://hashnode.com/posts/style-nextjs-with-bootstrap-5-sass-and-purgecss/60c1f9cb18e6d852c62ee73a/comment/611f4123a5d08237f40ddd46)

Tailwind do trim unwanted css with new **JIT** mode Without using **purgeCss** unlike bootstrap. And every website looks almost same in Bootstrap, while in tailwind you have got complete control over the design. Without using any external libs

[Zack Sheppard](https://hashnode.com/@zackdotcomputer)

[Aug 20, 2021](https://hashnode.com/posts/style-nextjs-with-bootstrap-5-sass-and-purgecss/60c1f9cb18e6d852c62ee73a/comment/611f4123a5d08237f40ddd46#reply-611f653ca5d08237f40de18d)

[Tailwind JIT](https://tailwindcss.com/docs/just-in-time-mode) does look really interesting. But I disagree with the cliche insult for Bootstrap, "that it makes every site look the same." You _do_ have complete control over everything in Bootstrap, just like you do in Tailwind.

I think it's mostly that most people either don't know or don't care about customizing Bootstrap's default theme and so just import it, copy in the default HTML template, and call it a day. Tailwind sites just hide how little people care about changing the default theme by providing less help applying it.

The point is that they're different tools and they have different pros and cons to them (which is why I use both on a month-to-month basis). You can say "a table saw has more power than a hand saw" but that doesn't mean its the right tool for every job.
