compiled .css files not pushed in repo

Hello everyone, I was adviced to not push my dist folder with .css files , infact I added the folder in a .gitignore but css style from my webpage is not showing now. Can anyone advice me what to do because I think I got that wrong … Ps. I created another folder with the main.css file and a script in a json that allows me to copy the changes from dist/main.css to css/main.css
13 Replies
vince
vince14mo ago
You should have a build command set up in your hosting provider. This allows you to keep your dist/ in your .gitignore
zexceed
zexceedOP14mo ago
I added the folder later on in the .gitignore because I had already pushed the dist previously . I just can’t understand the goal of that 😭
b1mind
b1mind14mo ago
You don't need the compiled code in your repo unless you are trying to serv it
vince
vince14mo ago
Typically you don't push the dist/ because it's a large folder filled with the output of your build command. It saves space in your repo if you include everything that's needed to build and you provide the build command so people who fork your repo can build it locally. Same idea with your hosting provider. Gitignore your dist/ repo and give the build command to your hosting provider so it knows how to build the files and serve an optimized, working version of your website
Jochem
Jochem14mo ago
additionally, in a team you'd have someone approve any pulls to your main branch, and those built files would just be double work
b1mind
b1mind14mo ago
Sidenote: Not all hosting works this way 😄
vince
vince14mo ago
Good to know because I only use Netlify 🤣
b1mind
b1mind14mo ago
yea I know you only know the Netlify way xD
Jochem
Jochem14mo ago
tbf the hosting that doesn't work that way is hosting where you can just run the build step yourself, generally and you likely still shouldn't include generated code, even if that means you have a slightly more manual deploy
zexceed
zexceedOP14mo ago
Do you think it was a good idea to copy the main.css in another folder and push it? I’d run a script to copy any changes made to the files with that
b1mind
b1mind14mo ago
no point if you have teh uncompiled code there already again unless you want to serv the .css files (host them) then no reason to include the build/dist in your repo.
Jochem
Jochem14mo ago
your hosting provider should have instructions on how to deploy if you have a build step, you should follow those and keep your generated CSS files out of the repo
zexceed
zexceedOP14mo ago
Perfect, thank you so much for your help guys, I will try to inform myself better about this matter !
Want results from more Discord servers?
Add your server