16

I'm very new to scss and css so please bear with me. I've done some research but found conflicting information.

I have 2 freelancers working on my project. Both freelancers make changes to:

style.css
style.css.map
style.scss

Everytime I merge their work I break the frontend. How can I merge their work without breaking everything?

I read online that these files should not be included in GIT? I also read that I should used GULP or LESS? Apparently, I should compile the merged code before committing? Seriously confused with the research.

How do I handle these files?

Boosted_d16
  • 13,340
  • 35
  • 98
  • 158
  • 3
    `styles.css` and `styles.css.map` are *generated* code, they shouldn't be edited directly and shouldn't be in version control. `styles.scss` is the canonical version that you want to track. – jonrsharpe Aug 08 '18 at 12:39
  • in that case, should I recompile the styles.scss once merged? – Boosted_d16 Aug 08 '18 at 12:42
  • 1
    That should be part of your build process, along with whatever other bundling/minifying/productionising you're doing before deployment. – jonrsharpe Aug 08 '18 at 13:03

2 Answers2

18

The .css file is generated from the .scss files. Your developers should commit only in the .scss files. In the most cases the .css file is not added to the repository at all. And you should not modify the .css file directly because it will be replaced with the next compilation of .scss the files.

GULP is just the tool that compiles the .scss files and create the css from them. Basically when using GULP you can create some functions where you can specify the input location(.scss), output location(.css) and additional rules, etc.

There are also other tools that can do this. Like Koala, Webpack.

NicuVlad
  • 2,491
  • 3
  • 28
  • 47
  • 2
    One good way to make sure they remember to change the .scss instead of the .css is to make sure SCSS exports a compact output. It is in the options. It makes it obvious that it is not the file to edit (unless you are a masochist) and it also makes the download of your file potentially faster. – Mig R Sep 17 '18 at 09:46
5

You probably should not store generated files in git. In this case, the generated files would be the .css and .css.map files that compass (I'm assuming you use compass because of the tags) generates for you. You should store the .scss file in source control, and compile it to .css afterwards.

If the freelancers are making direct manual changes to the .css files, they should know that at each recompile those changes will be lost.

user10186512
  • 453
  • 2
  • 7