Is it possible to add TailwindCSS 3? #703
-
I tried to add it but I was not successful. Has anyone tried to add Tailwindcss to this template? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
This comment has been hidden.
This comment has been hidden.
-
Yes, but with the new update you need to add the tailwind.config.js and postcss.config.js in the root and in the packages/renderer |
Beta Was this translation helpful? Give feedback.
-
(updated) There is a more elegant way of doing this that doesn't involve maintaining two Most of the steps below you would have to do in one way or another to set up any tailwind project and there are just a few tweaks that need doing. Essentially, you need to give both your
npm install -D tailwindcss postcss autoprefixer
import { join, dirname } from 'path';
import { fileURLToPath } from 'node:url';
import type { Config } from 'tailwindcss';
const PACKAGE_ROOT = dirname(fileURLToPath(import.meta.url));
export default {
content: [
join(PACKAGE_ROOT, './index.html'),
join(PACKAGE_ROOT, './src/**/*.{js,ts,jsx,tsx,vue}'),
],
theme: {
extend: {},
},
} satisfies Config;
import { join, dirname } from 'path';
import { fileURLToPath } from 'node:url';
import tailwindcss from 'tailwindcss';
import autoprefixer from 'autoprefixer';
const PACKAGE_ROOT = dirname(fileURLToPath(import.meta.url));
export default {
plugins: [tailwindcss(join(PACKAGE_ROOT, './tailwind.config.ts')), autoprefixer],
};
@tailwind base;
@tailwind components;
@tailwind utilities;
// inside the script tag of your App.vue file or in your main.tsx file
import '/@/index.css'; That's it, tailwind should now be working for your builds and dev setup with hot module replacement. This seems to be a more optimal way of setting up Tailwind with an Electron Vite project that uses this boilerplate. |
Beta Was this translation helpful? Give feedback.
Yes, but with the new update you need to add the tailwind.config.js and postcss.config.js in the root and in the packages/renderer