Skip to content

Instantly share code, notes, and snippets.

@chriseppstein
Created January 18, 2011 05:56
Show Gist options
  • Select an option

  • Save chriseppstein/784033 to your computer and use it in GitHub Desktop.

Select an option

Save chriseppstein/784033 to your computer and use it in GitHub Desktop.

Revisions

  1. chriseppstein created this gist Jan 18, 2011.
    49 changes: 49 additions & 0 deletions compass.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    if ENV['RAILS_ENV'] && !defined?(RAILS_ENV)
    Object.const_set("RAILS_ENV", ENV['RAILS_ENV'])
    end

    # Require any additional compass plugins here.
    require 'grid-coordinates'
    require 'compass-fancybox-plugin'
    require 'susy'

    project_type = :rails
    project_path = RAILS_ROOT if defined?(RAILS_ROOT)
    css_dir = "public/stylesheets/compiled"
    sass_dir = "app/stylesheets"
    cache_dir = "tmp/sass-cache"
    http_path = "/"

    relative_assets = true if defined?(RAILS_ENV) && RAILS_ENV == "development"

    # disable asset cache buster
    asset_cache_buster do |http_path, real_path|
    nil
    end

    line_comments = true
    environment = :development
    output_style = :expanded

    if defined?(RAILS_ENV) && ["production", "staging", "integration", "edge"].include?(RAILS_ENV)
    line_comments = false
    environment = :production
    output_style = :compressed
    asset_host do |path|
    path=path.split('?')[0] if path.is_a?(String) # ignore url parameters when calculating asset host: google labs performance likes consistency
    if RAILS_ENV == "staging"
    "//d3ib7c8kxtj10x.cloudfront.net"
    elsif RAILS_ENV == "integration"
    "//d3n8wz4vki95n1.cloudfront.net"
    elsif RAILS_ENV == "edge"
    "//www.edge.caring.com"
    else
    "//d1i6umwpordaqg.cloudfront.net"
    end
    end
    end

    Dir.glob("vendor/plugins/*/app/stylesheets").each do |dir|
    add_import_path dir
    end