This repository was archived by the owner on May 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 33To add Tailwind to a Next (^9.2.0) project, start by installing ` tailwindcss ` , ` postcss-import ` and ` autoprefixer ` :
44
55``` sh
6- npm install tailwindcss postcss-import autoprefixer
6+ npm install tailwindcss postcss-import autoprefixer --save
77```
88
99Next, set up your PostCSS plugins by creating a ` postcss.config.js ` file and adding the following configuration:
@@ -43,3 +43,32 @@ class MyApp extends App {
4343
4444export default MyApp
4545```
46+ ## Setting up Purgecss (optional)
47+ To add Purgecss, start by installing ` @fullhuman/postcss-purgecss ` .
48+
49+ ``` sh
50+ npm install @fullhuman/postcss-purgecss --save
51+ ```
52+
53+ Finally, add Purgecss to PostCSS plugins by updating the ` postcss.config.js ` file and adding the following configuration:
54+
55+ ``` js
56+ const purgecss = [
57+ " @fullhuman/postcss-purgecss" ,
58+ {
59+ content: [" ./components/**/*.js" , " ./pages/**/*.js" ],
60+ defaultExtractor : content => content .match (/ [\w -/ :] + (?<!:)/ g ) || []
61+ }
62+ ];
63+ module .exports = {
64+ plugins: [
65+ " postcss-import" ,
66+ " tailwindcss" ,
67+ " autoprefixer" ,
68+ ... (process .env .NODE_ENV === " production" ? [purgecss] : [])
69+ ]
70+ };
71+
72+ ```
73+
74+ [ Learn more about using Purgecss with Tailwind here.] ( https://tailwindcss.com/docs/controlling-file-size#setting-up-purgecss )
You can’t perform that action at this time.
0 commit comments