Description
🐞 Problem Description
Currently, integrating Tailwind CSS into a new electron-vite
project requires users to manually perform several steps after the initial project scaffolding:
- Installing necessary dependencies (
tailwindcss
,postcss
,autoprefixer
). - Manually generating and configuring
tailwind.config.js
andpostcss.config.js
. - Adding the core
@tailwind
directives to a main CSS file and ensuring it's imported correctly in the renderer entry point.
This manual process:
- Introduces potential friction and opportunity for errors during the initial setup phase.
- Forces users to rely on external guides, which can become outdated.
Crucially, with the significant changes in Tailwind CSS v4, including the deprecation of the tailwind.config.js
file, the recommended configuration method is evolving. An official, integrated setup within electron-vite
is necessary to provide users with a reliable and up-to-date configuration method from day one, preventing issues caused by following outdated manual instructions.
Suggested solution
💡 Suggested Solution
Enhance the electron-vite quickstart/electron
command to offer an optional, automated setup for Tailwind CSS specifically for the renderer process.
This could be triggered via:
- An interactive prompt during the quickstart: "Would you like to add Tailwind CSS? (y/n)"
- A dedicated command-line flag:
--with-tailwind
or similar.
If the user opts-in, the quickstart script should automatically:
- Install
tailwindcss
,postcss
, andautoprefixer
as dev dependencies. - Configure
postcss.config.js
to properly include Tailwind and Autoprefixer. - Implement the recommended configuration approach for Tailwind CSS v4 (handling the deprecated
tailwind.config.js
). - Create or modify a main CSS file (e.g.,
src/renderer/src/style.css
). - Add the @import "tailwindcss" in the main css
- redefine the css variables , accordingly
- Ensure the main CSS file is imported correctly in the renderer's entry point (e.g.,
src/renderer/src/main.ts
). - Optionally, add a minimal example (like a styled element) for quick verification that Tailwind is working.
This automated process would provide a streamlined, officially supported, and future-proof way for developers to start using Tailwind CSS with electron-vite
immediately.
Validations
- Follow the Code of Conduct.
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.