Skip to content

🎥 Make videos programmatically with React

Add documentation for how to use with TailwindCSS

Jonny Burger69b079e5f427
diff --git a/packages/docs/docs/overwriting-webpack-config.md b/packages/docs/docs/overwriting-webpack-config.md
index 25aca164bc..5e74c4a6d3 100644
--- a/packages/docs/docs/overwriting-webpack-config.md
+++ b/packages/docs/docs/overwriting-webpack-config.md
@@ -85,6 +85,94 @@ Config.Bundling.overrideWebpackConfig((currentConfiguration) => {
Create a file which contains `declare module '*.mdx';` in your project to fix a TypeScript error showing up.
:::
+### Enable TailwindCSS support
+
+1. Install the following dependencies:
+
+<Tabs
+defaultValue="npm"
+values={[
+{ label: 'npm', value: 'npm', },
+{ label: 'yarn', value: 'yarn', },
+]
+}>
+<TabItem value="npm">
+
+```bash
+npm i postcss-loader postcss postcss-preset-env tailwindcss autoprefixer
+```
+
+ </TabItem>
+
+ <TabItem value="yarn">
+
+```bash
+yarn add postcss-loader postcss postcss-preset-env tailwindcss autoprefixer
+```
+
+ </TabItem>
+</Tabs>
+
+2. Add the following to your [`remotion.config.ts`](/docs/config) file:
+
+```ts
+Config.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"],
+ },
+ },
+ },
+ ],
+ },
+ ],
+ },
+ };
+});
+```
+
+3. Create a file `src/style.css` with the following content:
+
+```css
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
+```
+
+4. Import the stylesheet in your `src/index.ts` file. Add to the top of the file:
+
+```js
+import "/style.css";
+```
+
+5. Start using TailwindCSS! You can verify that it's working by adding `className="bg-red-900"` to any element.
+
+6. _Optional_: Add a `tailwind.config.js` file to the root of your project. Add `/* eslint-env node */` to the top of the file to get rid of an ESLint rule complaining that `module` is not defined.
+
### Enable SASS/SCSS support
1. Install the following dependencies: