r/css • u/ayoub0217 • Mar 16 '26
Help Converting scss to css in a modular way
I am creating a project with vanilla html css js. I chose to use a template for faster and cleaner developement, but every template I found uses scss instead of css.I looked online and tried many ways:
1/ Use the main.css compiled file in the /dist which makes it impossible to navigate the code (15000 lines)
2/ Use online compilers which don't work, because copy pasting one file at a time gives error since it's missinig dependencies from the rest of files . when I try to add every file and code a certain file depends on the online compiler breaks
3/ manually convert scss files that are needed for my project ( gives broken layout and many bugs and issues)
My goal is to have a modular css/ folder just like the scss's template folder so I can work with it and tweak it as needed
Can anyone help me to find a solution? I've spent several days on this task and I am hitting a roadblock for a problem that seems too trivial
Here's the link to the template I am using : https://adminlte.io/
•
u/AutoModerator Mar 16 '26
To help us assist you better with your CSS questions, please consider including a live link or a CodePen/JSFiddle demo. This context makes it much easier for us to understand your issue and provide accurate solutions.
While it's not mandatory, a little extra effort in sharing your code can lead to more effective responses and a richer Q&A experience for everyone. Thank you for contributing!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
7
u/DunkingTea Mar 16 '26
Not sure what you’re wanting. Usually you’d work from the scss files as your working files, and compile them to a single main.css file after each edit to a scss file. But you don’t edit the main.css file. That’s just a minified and compiled css version of the more readable and workable scss files
2
u/RJ_MacreadysBeard Mar 16 '26
create a base css file (page(s) template), a design-file css (colours, borders, bg's etc), a component css file (reusable parts, buttons, cards, dropdowns, etc), have them reference each other, and reference them in your html? Sorry I'm noobish (for about 40years) but that's what I did for my vanilla site.
1
u/Rzah Mar 16 '26
Your options are:
1
u/Fancy_Mushroom7387 Mar 16 '26
You’re making this harder than it needs to be. The normal workflow with templates like that is not to convert SCSS to modular CSS manually, but to compile the SCSS locally and keep using the SCSS structure.
SCSS files depend on each other (_variables.scss, _mixins.scss, partials, etc.), so copying files one by one will always break. That’s why the compiled main.css is huge. The easiest fix is just install Sass locally and compile the whole folder.
1
u/bostiq Mar 16 '26
"Live sass compiler" for vs code can compile the single scss files, but you need to make sure they reference each other, I guess with
@import, before you compile them.This would drive me up the wall but I guess you can get use to it.
I actually had to kill this behaviour after an update: the extension was creating single files .css from the sass partials. you'd need to play with the settings though.
1
u/[deleted] Mar 16 '26
So, oddly? This is one of those things that agentic AI is really good at. Just tell it to convert your SCSS files to CSS files and it will. However, you will still need something to merge the files for publishing. This is why everyone uses things like SCSS and PostCSS. Otherwise you basically need a single large (or multiple smaller but still rather large) files.
If you have a SCSS project that compiles out to 15,000 lines the real answer is migrating from SCSS or something like it is basically unrealistic. That's too much CSS to manage as a single file (I know, I've done it many times) and you will end up just adding more and more to it.
If they want an alternative? CSS Modules is basically CSS with some extra power. But realistically you could just do SCSS Modules.
What you're asking is "how do I do a major refactor of how we style the project?" and, honestly, with kindness, I don't think you have the skillset.
If your client is saying no SCSS I have questions about why they're involved in the conversation. If the dev team you're a part of is saying no SCSS then you should be getting guidance from a more senior engineer about how they want to proceed. If they have in-house devs and you're a contractor it's the same conversation.
There is no simple solution to this that isn't you end up with a single large CSS file. Anything else requires a build step or you taking that one large CSS file and manually chopping it up.
You could try having agentic AI help with that but I'm not sure I'd trust it.