I’m working on a project in Laravel 12 using Vite, and I have a directory like resources/css/partials/ that contains several separate CSS files. Right now, Vite only compiles the files that I explicitly import. I would like Vite to automatically include and compile all CSS files inside that folder without manually adding each one.
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.Toni– Toni2025-11-16 06:19:10 +00:00Commented Nov 16 at 6:19
-
Solution 1: Use a glob import in your main CSS file (recommended)Vishal Yadav– Vishal Yadav2025-11-16 07:21:37 +00:00Commented Nov 16 at 7:21
-
Solution 2: Use Vite glob import inside your JS entryVishal Yadav– Vishal Yadav2025-11-16 07:21:52 +00:00Commented Nov 16 at 7:21
-
Solution 3: Use @import with subfolders (recursive)Vishal Yadav– Vishal Yadav2025-11-16 07:22:07 +00:00Commented Nov 16 at 7:22
-
The glob import order is not guaranteed. If you need specific ordering (e.g., variables → utilities → components), consider prefixing filenames:Vishal Yadav– Vishal Yadav2025-11-16 07:22:30 +00:00Commented Nov 16 at 7:22
Add a comment
|