Skip to main content

Best Practices

When working with SCSS (Sassy CSS) files, it's important to keep them manageable and maintainable.

Whether or not to ignore CSS map files (*.css.map)

It depends on your specific use case and development workflow.

  1. Purpose of CSS map files: CSS map files are typically generated by preprocessors like Sass or Less and are used for debugging purposes. They provide a mapping between the compiled CSS and the original source files, making it easier to debug and inspect styles during development. However, they are not necessary for the production version of your website or application.

  2. Repository size and performance: CSS map files can be relatively large, especially for projects with a significant amount of CSS code. Including them in your Git repository can increase its size over time and potentially impact performance, especially when cloning or performing operations like branching and merging.

  3. Collaboration and deployment: If you are working with a team of developers on a project, it's essential to consider the impact of CSS map files on collaboration and deployment processes. If the map files are not crucial for other team members or the deployment process, ignoring them can simplify workflows and reduce unnecessary file transfers.

  4. Version control and history: If CSS map files are generated as part of your build process and can be easily regenerated, it might make sense to exclude them from version control. This ensures that your repository focuses on the essential source code and assets required to build and deploy your project, rather than intermediate or generated files.

Keep in mind that these considerations are general guidelines, and the specific requirements of your project may vary. It's always a good idea to discuss with your team and consider the needs of your development and deployment processes before deciding whether to ignore CSS map files in your Git repository.

Naming Convention

Filename underscore: The underscore lets Sass know that the file is only a partial file and that it should not be generated into a CSS file.