Created
March 18, 2020 16:42
-
-
Save laurendorman/d6fbebbd794cbf12ffedccb490bf3e2b to your computer and use it in GitHub Desktop.
Gatsby + TailwindCSS + PostCSS + PurgeCSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "example", | |
"private": true, | |
"description": "A simple starter to get up running with Gatsby + TailwindCSS + PostCSS + PurgeCSS", | |
"version": "0.1.0", | |
"author": "Lauren Dorman <[email protected]>", | |
"dependencies": { | |
"gatsby": "^2.19.6", | |
"gatsby-image": "^2.2.39", | |
"gatsby-plugin-manifest": "^2.2.38", | |
"gatsby-plugin-offline": "^2.2.10", | |
"gatsby-plugin-postcss": "^2.1.19", | |
"gatsby-plugin-react-helmet": "^3.1.21", | |
"gatsby-plugin-sharp": "^2.4.2", | |
"gatsby-source-filesystem": "^2.1.46", | |
"gatsby-transformer-sharp": "^2.3.13", | |
"prop-types": "^15.7.2", | |
"react": "^16.12.0", | |
"react-dom": "^16.12.0", | |
"react-helmet": "^5.2.1" | |
}, | |
"devDependencies": { | |
"@fullhuman/postcss-purgecss": "^1.3.0", | |
"postcss-cli": "^6.1.3", | |
"postcss-import": "^12.0.1", | |
"postcss-preset-env": "^6.7.0", | |
"prettier": "^1.19.1", | |
"tailwindcss": "^1.1.4" | |
}, | |
"keywords": [ | |
"gatsby", | |
"tailwindcss", | |
"postcss", | |
"purgecss" | |
], | |
"license": "MIT", | |
"scripts": { | |
"build": "gatsby build", | |
"develop": "gatsby develop", | |
"css": "postcss src/styles/index.css -o public/static/css/styles.css", | |
"format": "prettier --write \"**/*.{js,jsx,json,md}\"", | |
"start": "npm run develop", | |
"serve": "gatsby serve", | |
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing \"" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = () => ({ | |
plugins: [ | |
require("postcss-preset-env")({ | |
stage: 0, | |
}), | |
require("postcss-import"), | |
// See: https://www.gatsbyjs.org/docs/tailwind-css/#option-1-postcss | |
require("tailwindcss")("./tailwind.config.js"), | |
require("autoprefixer"), | |
// See: https://purgecss.com/plugins/postcss.html#usage | |
require("@fullhuman/postcss-purgecss")({ | |
content: ["./src/**/*.js"], | |
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [], | |
whitelist: ['html', 'body', 'gatsby-focus-wrapper'] | |
}), | |
require("cssnano")({ | |
preset: "default", | |
}), | |
], | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment