Configure TailwindCSS in a Chrome Extension using Webpack #3139
-
I'm trying to configure Tailwind in a Chrome Extension that uses this boilerplate → https://github.com/sivertschou/react-typescript-chrome-extension-boilerplate/tree/christmas So far I've installed the following packages: ➜ npm install tailwindcss@latest postcss@latest autoprefixer@latest
I've also initialized ➜ npx tailwindcss init tailwind.config.jsmodule.exports = {
purge: [],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
} postcss.config.jsmodule.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
} styles/tailwind.css@tailwind base;
@tailwind components;
@tailwind utilities; popup.tsximport './styles/tailwind.css' Now how do I use PostCSS to bundle these files? I think I'm stuck on https://tailwindcss.com/docs/installation#building-your-css How do I do it? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Alright solved it by installing ➜ npm install --save-dev postcss-loader postcss Just had to add in {
test: /\.css$/,
use: ['style-loader', 'css-loader', 'postcss-loader'],
exclude: /\.module\.css$/,
}, |
Beta Was this translation helpful? Give feedback.
-
I think a Webpack Guide should be added in Tailwind docs like the other ones because let's be honest everyone hates Webpack but still uses it. Would love to know about: ➜ npm install tailwindcss@latest postcss@latest autoprefixer@latest Why do we need |
Beta Was this translation helpful? Give feedback.
-
Also, would love to know how to add module.exports = {
purge: ['./src/**/*.tsx', './src/**/*.ts'],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
} I tried different variations like |
Beta Was this translation helpful? Give feedback.
Alright solved it by installing
postcss-loader
:Just had to add in
webpack.config.js
: