TailwindCSS v2 (Legacy)
info
This documentation concerns TailwindCSS v2. See here for V3!
- Install the following dependencies:
- npm
- yarn
- pnpm
npm i postcss-loader postcss postcss-preset-env tailwindcss@2 autoprefixerpnpm i postcss-loader postcss postcss-preset-env tailwindcss@2 autoprefixeryarn add postcss-loader postcss postcss-preset-env tailwindcss@2 autoprefixer- Add the following to your
remotion.config.tsfile:
Config .overrideWebpackConfig ((currentConfiguration ) => {
return {
...currentConfiguration ,
module : {
...currentConfiguration .module ,
rules : [
...(currentConfiguration .module ?.rules
? currentConfiguration .module .rules
: []
).filter ((rule ) => {
if (!rule ) {
return false;
}
if (rule === "...") {
return false;
}
if (rule .test ?.toString ().includes (".css")) {
return false;
}
return true;
}),
{
test : /\.css$/i,
use : [
"style-loader",
"css-loader",
{
loader : "postcss-loader",
options : {
postcssOptions : {
plugins : [
"postcss-preset-env",
"tailwindcss",
"autoprefixer",
],
},
},
},
],
},
],
},
};
});- Create a file
src/style.csswith the following content:
@tailwind base;
@tailwind components;
@tailwind utilities;- Import the stylesheet in your
src/Root.tsxfile. Add to the top of the file:
import "./style.css";-
Start using TailwindCSS! You can verify that it's working by adding
className="bg-red-900"to any element. -
Optional: Add a
tailwind.config.jsfile to the root of your project. Add/* eslint-env node */to the top of the file to get rid of an ESLint rule complaining thatmoduleis not defined.
warning
Due to a caching bug, the config file might not be picked up until you remove the node_modules/.cache folder - watch this issue: https://github.com/remotion-dev/remotion/issues/315