is there any way to make my sass files less messy?

As you can see, for every sass file I make, there's the map and the regular css file that comes with it, but it makes my css folder pretty messy, is there any way to hide the unnecessary ones and only keep the sass? would making a sass folder and putting the sass files inside while keeping the other files inside the css folder work?
No description
16 Replies
ἔρως
ἔρως4d ago
shouldnt the css files go to the public folder?
vince
vince4d ago
Look up the 7-1 pattern
Kevin Powell
Kevin Powell3d ago
if you don't want a Sass file to be compiled, start the name with an underscore: _example.scss
StarPlatinumSan
Ohhh does that affect the website on a live browser in any way? Or if someone else pulls my project? So everything but the jsx files goes in the public folder?
Kevin Powell
Kevin Powell3d ago
No, leave the CSS there. You're using Vite, so only static files should be in public, like your images and whatnot
Kevin Powell
Kevin Powell3d ago
As for the Sass files, generally you'll have subfolders to help keep things organized, and just have the main .scss file Like, this is from my most recent project. The only file that's being compiled into a .css file is my main.css
No description
Kevin Powell
Kevin Powell3d ago
Actually, I do have to ask, how are you compiling your Sass? You're using Vite, so you shouldn't have any .css folders or maps anywhere until you build the project, and they wouldn't be in your src
ἔρως
ἔρως3d ago
not gonna lie, i don't know while the documentation says to use _index.scss, i prefer to use index.scss, and it works the same, but looks different
StarPlatinumSan
Ohhh that helps a lot I use the sass vscode extension Should I just import sass with an npm?
Kevin Powell
Kevin Powell3d ago
Doesn't work the same though, it'll compile extra files if you do that Yeah, you already have vite going, which can handle that. Once you install it as a dependency, it'll take care of it for you. Just make sure you import the .scss file where you need it, and don't link to the CSS file itself. If you important the scss file vite will figure it out for you
StarPlatinumSan
Wait it's actually you Kevin yourself that is answering I just realized wow hahaha But I think I understand what you mean, I'm probably gon look up a video to make sure I do the right steps Thank you!
ἔρως
ἔρως3d ago
depending on the configuration, yes
Kevin Powell
Kevin Powell3d ago
I've never seen a configuration for Sass that doesn't do that. Not saying it's not possible, but it'd be outside of the scope of the sass compiler to even make that change afaik
ἔρως
ἔρως3d ago
with webpack (using laravel mix), i specified the files i wanted to compile and it did the thing obviously, following the documentation is better, but it's so ugly
Kevin Powell
Kevin Powell3d ago
fair enough
ἔρως
ἔρως3d ago
it works better than expected, as i have a specific .scss file for each thing i need