Nothing Special   »   [go: up one dir, main page]

Skip to content

Tailwindcss v3 webpack plugin for CRA (Create React App) v3/v4

License

Notifications You must be signed in to change notification settings

roneyrao/tailwind-cra-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

tailwind-cra-webpack-plugin

Tailwindcss v3 webpack plugin for CRA (Create React App) v3/v4

Background

  • Tailwindcss v3 doesn't support postcss v7, which is shipped in Create React App v3 and v4
  • The official method to work with webpack also has issues

Usage

  • install
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest tailwind-cra-webpack-plugin
# Add `postcss-import` if you needs `@import`
  • apply
// craco.config.js as example

const { TailwindWebpackPlugin } = require('tailwind-cra-webpack-plugin')

module.exports = {
  webpack: {
    plugins: [
+     // The css entry point
+     new TailwindWebpackPlugin(require.resolve('../src/index.css')),
    ],
  },
- // These are not needed anymore
- postcss: {
-   plugins: [
-     require('tailwindcss'),
-     require('autoprefixer'),
-   ],
- },
}

Notes

Only tested in CRA3 (nodejs v14), works in v4 theoretically.

About

Tailwindcss v3 webpack plugin for CRA (Create React App) v3/v4

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published