TailwindCSS
Using the template
The easiest way to get started with Tailwind and Remotion is to use the template by cloning it on GitHub or running the following:
- npm
- yarn
- pnpm
bashnpx create-video --tailwind
bashnpx create-video --tailwind
bashpnpm create video --tailwind
bashpnpm create video --tailwind
bashyarn create video -- --tailwind
bashyarn create video -- --tailwind
Install in existing project
- Install the following dependencies:
- npm
- yarn
- pnpm
bashnpm i postcss-loader postcss postcss-preset-env tailwindcss autoprefixer
bashnpm i postcss-loader postcss postcss-preset-env tailwindcss autoprefixer
bashyarn add postcss-loader postcss postcss-preset-env tailwindcss autoprefixer
bashyarn add postcss-loader postcss postcss-preset-env tailwindcss autoprefixer
bashpnpm i postcss-loader postcss postcss-preset-env tailwindcss autoprefixer
bashpnpm i postcss-loader postcss postcss-preset-env tailwindcss autoprefixer
- Add the following to your
remotion.config.tsfile:
tsConfig .Bundling .overrideWebpackConfig ((currentConfiguration ) => {return {...currentConfiguration ,module : {...currentConfiguration .module ,rules : [...(currentConfiguration .module ?.rules ?currentConfiguration .module .rules : []).filter ((rule ) => {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",],},},},],},],},};});
tsConfig .Bundling .overrideWebpackConfig ((currentConfiguration ) => {return {...currentConfiguration ,module : {...currentConfiguration .module ,rules : [...(currentConfiguration .module ?.rules ?currentConfiguration .module .rules : []).filter ((rule ) => {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:
css@tailwind base;@tailwind components;@tailwind utilities;
css@tailwind base;@tailwind components;@tailwind utilities;
- Import the stylesheet in your
src/Video.tsxfile. Add to the top of the file:
jsimport "./style.css";
jsimport "./style.css";
- Add a
tailwind.config.jsfile to the root of your project:
js/* eslint-env node */module.exports = {content: ["./src/**/*.{ts,tsx}"],theme: {extend: {},},plugins: [],};
js/* eslint-env node */module.exports = {content: ["./src/**/*.{ts,tsx}"],theme: {extend: {},},plugins: [],};
- Start using TailwindCSS! You can verify that it's working by adding
className="bg-red-900"to any element.