Skip to content

Instantly share code, notes, and snippets.

@dance2die
Last active April 26, 2020 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dance2die/23ed6eabd9f9f8928c68120b14abe0b4 to your computer and use it in GitHub Desktop.
Save dance2die/23ed6eabd9f9f8928c68120b14abe0b4 to your computer and use it in GitHub Desktop.
Gatsby Recipe for Tailwind CSS with TypeScript
const purgecss = require('@fullhuman/postcss-purgecss')({
// Specify the paths to all of the template files in your project
content: [
'./src/**/*.html',
'./src/**/*.js',
'./src/**/*.jsx',
'./src/**/*.ts',
'./src/**/*.tsx',
'./public/index.html',
],
// Include any special characters you're using in this regular expression
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
});
module.exports = {
plugins: [
require('tailwindcss'),
require('postcss-preset-env'),
...(process.env.NODE_ENV === 'production' ? [purgecss, cssnano] : []),
],
};
// See https://tailwindcss.com/docs/configuration for details
module.exports = {
theme: {},
variants: {},
// https://github.com/tailwindcss/custom-forms
plugins: [require("@tailwindcss/custom-forms")],
};
/*! purgecss start ignore */
@tailwind base;
@tailwind components;
/*! purgecss end ignore */
@tailwind utilities;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment