Question

I'm using SASS files in Rails development. And I wonder if I should gitignore generated CSS files.

The problem with adding CSS files in Git is that they are simply redundant. SASS files at public/stylesheets/sass are the files I need.

So I have the following lines in gitignore:

# public/stylesheets/*.css

But if I do this, when I push my app to Heroku, there's no CSS files obviously.

  • What could be the best practices for managing SASS/CSS files?

I have never tried assets packing (e.g., minifying CSS files for production environment), but I plan to do that as well when I deploy to non-Heroku environment with Capistrano.

Was it helpful?

Solution

Here's a heroku blog post about their plugin to generate CSS from your Sass on their servers. http://blog.heroku.com/archives/2009/8/18/heroku_sass/

OTHER TIPS

My method is to keep a dedicated local branch to track everything that will be pushed to Heroku. Your mileage may vary, but this works well for me and feels pretty cleanly organized.

You should not commit the generated CSS files into Git and to deal with read-only filesystems (like Heroku) you should use the hassle gem (the sass_on_heroku plugin is now deprecated).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top