---
title: Integrating Compass with a Git / Capistrano deployment workflow
description: When we added the Compass CSS authoring framework to our projects, new wrinkles appeared in the deployment process.  Committing the artifacts to Git was used for our first prototypes, but is unsuitable for team projects because it's a sure-fire way to introduce merge conflicts.  Running compass on the server (either with Cap or the Drupal module) is appealing, but a minority of our projects deploy to hosts without the ability to install Compass.  Rather than support multiple strategies, we decided on executing Compass locally on the workstation running Capistrano.  Changes are needed to several files:
---

[Blog ](https://www.metaltoad.com/blog)

# [Integrating Compass with a Git / Capistrano deployment workflow](https://www.metaltoad.com/blog/integrating-compass-git-capistrano-deployment-workflow)

 Written by [Metal Toad Staff](https://www.metaltoad.com/blog/author/metal-toad-staff) | Jan 27, 2012 12:00:00 AM

 Filed under:

- [Drupal](https://www.metaltoad.com/help/drupal)
- [Capistrano](https://www.metaltoad.com/help/capistrano)
- [Cascading Style Sheets (CSS)](https://www.metaltoad.com/help/css)

When we added the [Compass](http://compass-style.org/) CSS authoring framework to our projects, new wrinkles appeared in the deployment process (which is based on [Capistrano](https://www.metaltoad.com/taxonomy/term/47). Several workflow options were considered:

- Committing the artifacts to Git
- Generating the artifacts on the server
- Using the Drupal [Compass](http://drupal.org/project/compass) or [Sassy](http://drupal.org/project/sassy) module
- Generating the artifacts on the workstation running Capistrano

Committing the artifacts to Git was used for our first prototypes, but is unsuitable for team projects because it's a sure-fire way to introduce merge conflicts. Running compass on the server (either with Cap or the Drupal module) is appealing, but a minority of our projects deploy to hosts without the ability to install Compass. Rather than support multiple strategies, we decided on the last option - executing Compass on the workstation running Capistrano.

Changes are needed to several files:

### .gitignore

```
compass_app_log.txt
.sass-cache
compass_generated_stylesheets
*-s[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].png
```

### config.rb (Compass)

```
http_path = "/sites/all/themes/metaltoad/"
css_dir = "compass_generated_stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "compass_javascripts"
fonts_dir = "fonts"
```

### theme.info

```
stylesheets[all][] = compass_generated_stylesheets/screen.css
stylesheets[all][] = compass_generated_stylesheets/media.css
stylesheets[all][] = compass_generated_stylesheets/print.css
```

### config/deploy.rb (Capistrano)

```
# build Compass artifacts
set :theme_path, "#{app_root}/sites/all/themes/metaltoad"
 
after "deploy:update_code" do
  run_locally("cd #{theme_path}; compass clean")
  run_locally("cd #{theme_path}; compass compile --output-style compressed")
  upload("#{theme_path}/compass_generated_stylesheets",
    "#{release_path}/#{theme_path}/compass_generated_stylesheets")
  # Glob is nasty, but the generated_images directory
  # option isn't supported until Compass 0.12.
  Dir.glob("#{theme_path}/images/*-s[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].png").each do|f|
    upload(f, "#{release_path}/#{f}")
  end
end
```

Long-term, we'll probably migrate `after "deploy:update_code"` to a proper Capfile task.

[View full post](https://www.metaltoad.com/blog/integrating-compass-git-capistrano-deployment-workflow)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Metal Toad Staff"
  },
  "dateModified" : "2023-12-06T23:31:53.848Z",
  "datePublished" : "2012-01-27T00:00:00Z",
  "headline" : "Integrating Compass with a Git / Capistrano deployment workflow",
  "image" : {
    "@type" : "ImageObject",
    "height" : 500,
    "url" : "https://6104926.fs1.hubspotusercontent-na1.net/hubfs/6104926/Imported_Blog_Media/Metal_Toad_blog_generic-Aug-11-2023-10-02-31-1838-PM.jpg",
    "width" : 870
  },
  "mainEntityOfPage" : "https://www.metaltoad.com/blog/integrating-compass-git-capistrano-deployment-workflow",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60.0,
      "url" : "https://6104926.fs1.hubspotusercontent-na1.net/hubfs/6104926/social-suggested-images/6104926.fs1.hubspotusercontent-na1.nethub6104926hubfsMetal_Toad_Logo_orange_horizontal-50-1.jpg",
      "width" : 240.00002
    },
    "name" : "Blog"
  }
}
```