From e31e62bdd9cd7913f5a37742145bd19aa120dd4b Mon Sep 17 00:00:00 2001
From: Chris Eppstein <chris@eppsteins.net>
Date: Sat, 28 May 2011 02:11:30 -0700
Subject: [PATCH 1/9] Strong tags in the docs should be bold.

---
 doc-src/content/stylesheets/partials/_typography.scss | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc-src/content/stylesheets/partials/_typography.scss b/doc-src/content/stylesheets/partials/_typography.scss
index fe85f130..3e70c53a 100644
--- a/doc-src/content/stylesheets/partials/_typography.scss
+++ b/doc-src/content/stylesheets/partials/_typography.scss
@@ -29,7 +29,8 @@
   ul { list-style: none; margin-bottom: 1em;}
   h2 { line-height: 1.3em; margin-top: 0; padding-top: 3px;}
 }
-em { font-style: italic; }
+em     { font-style: italic; }
+strong { font-weight: bold;  }
 
 #page > article {
   ul ul { padding-left: 1em; }

From 5681f38e50a96cec6e3fd3177069043e76d592d6 Mon Sep 17 00:00:00 2001
From: Chris Eppstein <chris@eppsteins.net>
Date: Fri, 3 Jun 2011 09:44:24 -0700
Subject: [PATCH 2/9] Better string representation for the sprite importer.

---
 lib/compass/sass_extensions/sprites/sprites.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/compass/sass_extensions/sprites/sprites.rb b/lib/compass/sass_extensions/sprites/sprites.rb
index 7431983f..b03728fb 100644
--- a/lib/compass/sass_extensions/sprites/sprites.rb
+++ b/lib/compass/sass_extensions/sprites/sprites.rb
@@ -47,7 +47,7 @@ module Compass
     end
   
     def to_s
-      ""
+      self.class.name
     end
 
     def hash

From 4852e7803cdf655292d84dab1220a2037ed06e9d Mon Sep 17 00:00:00 2001
From: Chris Eppstein <chris@eppsteins.net>
Date: Fri, 3 Jun 2011 09:45:51 -0700
Subject: [PATCH 3/9] Fix a bug where import paths are added twice when using
 add_import_path in a configuration file.

---
 lib/compass/configuration/serialization.rb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/compass/configuration/serialization.rb b/lib/compass/configuration/serialization.rb
index ff41ecc2..bf7a5288 100644
--- a/lib/compass/configuration/serialization.rb
+++ b/lib/compass/configuration/serialization.rb
@@ -27,6 +27,7 @@ module Compass
         if @added_import_paths
           self.additional_import_paths ||= []
           self.additional_import_paths += @added_import_paths
+          self.additional_import_paths.uniq!
         end
         issue_deprecation_warnings
       end

From 1b689ce966d16e5e797a8933cae9ed5024569051 Mon Sep 17 00:00:00 2001
From: Chris Eppstein <chris@eppsteins.net>
Date: Fri, 3 Jun 2011 10:29:42 -0700
Subject: [PATCH 4/9] Basic Rails 3.1 integration.

---
 lib/compass/app_integration/rails.rb          | 15 ++++--
 .../app_integration/rails/actionpack2x.rb     | 10 ++++
 .../action_controller.rb                      |  0
 .../sass_plugin.rb                            |  0
 .../{actionpack2 => actionpack2x}/urls.rb     |  0
 .../app_integration/rails/actionpack30.rb     | 11 ++++
 .../{actionpack3 => actionpack30}/railtie.rb  |  5 +-
 .../app_integration/rails/actionpack31.rb     |  5 ++
 .../rails/actionpack31/railtie.rb             | 50 +++++++++++++++++++
 .../rails/configuration_defaults.rb           | 34 +++++++++----
 lib/compass/app_integration/rails/runtime.rb  | 22 +++-----
 lib/compass/configuration/helpers.rb          |  6 +++
 12 files changed, 127 insertions(+), 31 deletions(-)
 create mode 100644 lib/compass/app_integration/rails/actionpack2x.rb
 rename lib/compass/app_integration/rails/{actionpack2 => actionpack2x}/action_controller.rb (100%)
 rename lib/compass/app_integration/rails/{actionpack2 => actionpack2x}/sass_plugin.rb (100%)
 rename lib/compass/app_integration/rails/{actionpack2 => actionpack2x}/urls.rb (100%)
 create mode 100644 lib/compass/app_integration/rails/actionpack30.rb
 rename lib/compass/app_integration/rails/{actionpack3 => actionpack30}/railtie.rb (89%)
 create mode 100644 lib/compass/app_integration/rails/actionpack31.rb
 create mode 100644 lib/compass/app_integration/rails/actionpack31/railtie.rb

diff --git a/lib/compass/app_integration/rails.rb b/lib/compass/app_integration/rails.rb
index 06bc7764..b734d1af 100644
--- a/lib/compass/app_integration/rails.rb
+++ b/lib/compass/app_integration/rails.rb
@@ -24,8 +24,10 @@ module Compass
       end
 
       def configuration
-        Compass::Configuration::Data.new('rails').
-          extend(ConfigurationDefaults)
+        config = Compass::Configuration::Data.new('rails')
+        config.extend(ConfigurationDefaults)
+        config.extend(ConfigurationDefaultsWithAssetPipeline) if Sass::Util.ap_geq?('3.1.0.beta')
+        config
       end
 
       def env
@@ -48,12 +50,17 @@ module Compass
         end
       end
 
-      def initialize!(config = nil)
+      def check_for_double_boot!
         if booted?
-          Compass::Util.compass_warn("Warning: Compass was booted twice. Compass has a Railtie now; please remove your intializer.")
+          Compass::Util.compass_warn("Warning: Compass was booted twice. If you're using Rails 3, Compass has a Railtie now; please remove your compass intializer.")
         else
           booted!
         end
+      end
+
+      # Rails 2.x projects use this in their compass initializer.
+      def initialize!(config = nil)
+        check_for_double_boot!
         config ||= Compass.detect_configuration_file(root)
         Compass.add_project_configuration(config, :project_type => :rails)
         Compass.discover_extensions!
diff --git a/lib/compass/app_integration/rails/actionpack2x.rb b/lib/compass/app_integration/rails/actionpack2x.rb
new file mode 100644
index 00000000..f48299bb
--- /dev/null
+++ b/lib/compass/app_integration/rails/actionpack2x.rb
@@ -0,0 +1,10 @@
+%w(action_controller sass_plugin urls).each do |lib|
+  require "compass/app_integration/rails/actionpack2x/#{lib}"
+end
+
+# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
+class Sass::Script::Functions::EvaluationContext
+  include Sass::Script::Functions
+  private
+  include ActionView::Helpers::AssetTagHelper
+end
diff --git a/lib/compass/app_integration/rails/actionpack2/action_controller.rb b/lib/compass/app_integration/rails/actionpack2x/action_controller.rb
similarity index 100%
rename from lib/compass/app_integration/rails/actionpack2/action_controller.rb
rename to lib/compass/app_integration/rails/actionpack2x/action_controller.rb
diff --git a/lib/compass/app_integration/rails/actionpack2/sass_plugin.rb b/lib/compass/app_integration/rails/actionpack2x/sass_plugin.rb
similarity index 100%
rename from lib/compass/app_integration/rails/actionpack2/sass_plugin.rb
rename to lib/compass/app_integration/rails/actionpack2x/sass_plugin.rb
diff --git a/lib/compass/app_integration/rails/actionpack2/urls.rb b/lib/compass/app_integration/rails/actionpack2x/urls.rb
similarity index 100%
rename from lib/compass/app_integration/rails/actionpack2/urls.rb
rename to lib/compass/app_integration/rails/actionpack2x/urls.rb
diff --git a/lib/compass/app_integration/rails/actionpack30.rb b/lib/compass/app_integration/rails/actionpack30.rb
new file mode 100644
index 00000000..05e24df8
--- /dev/null
+++ b/lib/compass/app_integration/rails/actionpack30.rb
@@ -0,0 +1,11 @@
+# TODO figure something out so image_path works with rails integration
+%w(railtie).each do |lib|
+  require "compass/app_integration/rails/actionpack30/#{lib}"
+end
+
+# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
+class Sass::Script::Functions::EvaluationContext
+  include Sass::Script::Functions
+  private
+  include ActionView::Helpers::AssetTagHelper
+end
diff --git a/lib/compass/app_integration/rails/actionpack3/railtie.rb b/lib/compass/app_integration/rails/actionpack30/railtie.rb
similarity index 89%
rename from lib/compass/app_integration/rails/actionpack3/railtie.rb
rename to lib/compass/app_integration/rails/actionpack30/railtie.rb
index a3fc5498..2e52ae3b 100644
--- a/lib/compass/app_integration/rails/actionpack3/railtie.rb
+++ b/lib/compass/app_integration/rails/actionpack30/railtie.rb
@@ -40,7 +40,10 @@ module Compass
     initializer "compass.initialize_rails" do |app|
       # Configure compass for use within rails, and provide the project configuration
       # that came via the rails boot process.
-      Compass::AppIntegration::Rails.initialize!(app.config.compass)
+      Compass::AppIntegration::Rails.check_for_double_boot!
+      Compass.discover_extensions!
+      Compass.configure_sass_plugin!
+      Compass.handle_configuration_change!
     end
   end
 end
\ No newline at end of file
diff --git a/lib/compass/app_integration/rails/actionpack31.rb b/lib/compass/app_integration/rails/actionpack31.rb
new file mode 100644
index 00000000..bbd2d531
--- /dev/null
+++ b/lib/compass/app_integration/rails/actionpack31.rb
@@ -0,0 +1,5 @@
+# TODO figure something out so image_path works with rails integration
+%w(railtie).each do |lib|
+  require "compass/app_integration/rails/actionpack31/#{lib}"
+end
+
diff --git a/lib/compass/app_integration/rails/actionpack31/railtie.rb b/lib/compass/app_integration/rails/actionpack31/railtie.rb
new file mode 100644
index 00000000..6604e836
--- /dev/null
+++ b/lib/compass/app_integration/rails/actionpack31/railtie.rb
@@ -0,0 +1,50 @@
+require 'compass'
+require 'rails'
+
+class Rails::Railtie::Configuration
+  # Adds compass configuration accessor to the application configuration.
+  #
+  # If a configuration file for compass exists, it will be read in and
+  # the project's configuration values will already be set on the config
+  # object.
+  #
+  # For example:
+  #
+  #     module MyApp
+  #       class Application < Rails::Application
+  #          config.compass.line_comments = !Rails.env.production?
+  #          config.compass.fonts_dir = "app/assets/fonts"
+  #       end
+  #     end
+  #
+  # It is suggested that you create a compass configuration file if you
+  # want a quicker boot time when using the compass command line tool.
+  #
+  # For more information on available configuration options see:
+  # http://compass-style.org/help/tutorials/configuration-reference/
+  def compass
+    @compass ||= begin
+      data = if (config_file = Compass.detect_configuration_file) && (config_data = Compass.configuration_for(config_file))
+        config_data
+      else
+        Compass::Configuration::Data.new("rails_config")
+      end
+      data.project_type = :rails # Forcing this makes sure all the rails defaults will be loaded.
+      Compass.add_project_configuration(data)
+      data
+    end
+    @compass
+  end
+end
+
+module Compass
+  class Railtie < Rails::Railtie
+    initializer "compass.initialize_rails" do |app|
+      # Configure compass for use within rails, and provide the project configuration
+      # that came via the rails boot process.
+      Compass::AppIntegration::Rails.check_for_double_boot!
+      Compass.discover_extensions!
+      Compass.configure_rails!(app)
+    end
+  end
+end
\ No newline at end of file
diff --git a/lib/compass/app_integration/rails/configuration_defaults.rb b/lib/compass/app_integration/rails/configuration_defaults.rb
index fbab17e2..06aaf311 100644
--- a/lib/compass/app_integration/rails/configuration_defaults.rb
+++ b/lib/compass/app_integration/rails/configuration_defaults.rb
@@ -1,6 +1,28 @@
 module Compass
   module AppIntegration
     module Rails
+
+      module ConfigurationDefaultsWithAssetPipeline
+        # These methods overwrite the old rails defaults
+        # when rails 3.1 is detected.
+
+        def default_sass_dir
+          File.join("app", "assets", "stylesheets")
+        end
+
+        def default_images_dir
+          File.join("app", "assets", "images")
+        end
+
+        def default_fonts_dir
+          File.join("app", "assets", "fonts")
+        end
+
+        def default_javascripts_dir
+          File.join("app", "assets", "javascripts")
+        end
+      end
+
       module ConfigurationDefaults
 
         def project_type_without_default
@@ -8,11 +30,7 @@ module Compass
         end
 
         def default_sass_dir
-          if Sass::Util.ap_geq?('3.1.0.beta')
-            File.join("app", "assets", "stylesheets")
-          else
-            File.join("app", "stylesheets")
-          end
+          File.join("app", "stylesheets")
         end
 
         def default_css_dir
@@ -28,11 +46,7 @@ module Compass
         end
 
         def default_javascripts_dir
-          if Sass::Util.ap_geq?('3.1.0.beta')
-            File.join("app", "assets", "javascripts")
-          else
-            File.join("public", "javascripts")
-          end
+          File.join("public", "javascripts")
         end
 
         def default_http_images_path
diff --git a/lib/compass/app_integration/rails/runtime.rb b/lib/compass/app_integration/rails/runtime.rb
index d2765ef0..815fd29f 100644
--- a/lib/compass/app_integration/rails/runtime.rb
+++ b/lib/compass/app_integration/rails/runtime.rb
@@ -3,25 +3,15 @@ unless defined?(Compass::RAILS_LOADED)
   begin
     require 'action_pack/version'
     if ActionPack::VERSION::MAJOR >= 3
-      # TODO figure something out so image_path works with rails integration
-      %w(railtie).each do |lib|
-        require "compass/app_integration/rails/actionpack3/#{lib}"
+      if ActionPack::VERSION::MINOR < 1
+        require 'compass/app_integration/rails/actionpack30'
+      else
+        require 'compass/app_integration/rails/actionpack31'
       end
     else
-      %w(action_controller sass_plugin urls).each do |lib|
-        require "compass/app_integration/rails/actionpack2/#{lib}"
-      end
+      require 'compass/app_integration/rails/actionpack2x'
     end
-  rescue LoadError => e
+  rescue LoadError, NameError
     $stderr.puts "Compass could not access the rails environment."
-  rescue NameError => e
-    $stderr.puts "Compass could not access the rails environment."
-  end
-  
-  # Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
-  class Sass::Script::Functions::EvaluationContext
-    include Sass::Script::Functions
-    private
-    include ActionView::Helpers::AssetTagHelper
   end
 end
diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb
index db6f8af6..9017f735 100644
--- a/lib/compass/configuration/helpers.rb
+++ b/lib/compass/configuration/helpers.rb
@@ -77,6 +77,12 @@ module Compass
         end
       end
 
+      def configure_rails!(app)
+        app.config.compass.to_sass_engine_options.each do |key, value|
+          app.config.sass.send(:"#{key}=", value)
+        end
+      end
+
       def sass_engine_options
         configuration.to_sass_engine_options
       end

From 1a84305a04cae3ce639c5b73b21d7204a5e00361 Mon Sep 17 00:00:00 2001
From: Chris Eppstein <chris@eppsteins.net>
Date: Fri, 3 Jun 2011 15:06:02 -0700
Subject: [PATCH 5/9] Fix encoding issue.

---
 .../stylesheets/compass/css3/_font-face.scss   | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/frameworks/compass/stylesheets/compass/css3/_font-face.scss b/frameworks/compass/stylesheets/compass/css3/_font-face.scss
index b110d25a..6c7d511c 100644
--- a/frameworks/compass/stylesheets/compass/css3/_font-face.scss
+++ b/frameworks/compass/stylesheets/compass/css3/_font-face.scss
@@ -12,7 +12,10 @@
 //
 // If you need to generate other formats check out the Font Squirrel
 // [font generator](http://www.fontsquirrel.com/fontface/generator)
-
+//
+// Example:
+//
+//     +font-face("this name", font-files("this.woff", "woff", "this.otf", "opentype"), "this.eot")
 @mixin font-face(
   $name, 
   $font-files, 
@@ -28,16 +31,3 @@
     src: $font-files; 
   }
 }
-
-// EXAMPLE
-// +font-face("this name", font-files("this.woff", "woff", "this.otf", "opentype"), "this.eot")
-//
-// will generate:
-//
-//   @font-face { 
-//     font-family: 'this name'; 
-//     src: url('fonts/this.eot'); 
-//     src: local("☺"),
-//       url('fonts/this.otf') format('woff'), 
-//       url('fonts/this.woff') format('opentype'); 
-//   }

From 52e41d0455f717f6ebee0841dfb3359a2fdbdf41 Mon Sep 17 00:00:00 2001
From: Chris Eppstein <chris@eppsteins.net>
Date: Fri, 3 Jun 2011 15:29:47 -0700
Subject: [PATCH 6/9] This file has utf-8 chars in the comments.

---
 frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss | 1 +
 1 file changed, 1 insertion(+)

diff --git a/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss b/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss
index 1822bb11..b4b9cfd0 100644
--- a/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss
+++ b/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss
@@ -1,3 +1,4 @@
+@charset "utf-8";
 @import "typography";
 
 $alternate-text-font : "Warnock Pro", "Goudy Old Style", "Palatino", "Book Antiqua", Georgia, serif !default;

From 696d84562d63a3e799efa73a06ba9f24b8d5b73a Mon Sep 17 00:00:00 2001
From: Chris Eppstein <chris@eppsteins.net>
Date: Fri, 10 Jun 2011 16:00:56 -0700
Subject: [PATCH 7/9] Track rails branch as a different version state.

---
 VERSION.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION.yml b/VERSION.yml
index 968af04e..8f30c9a2 100644
--- a/VERSION.yml
+++ b/VERSION.yml
@@ -2,6 +2,6 @@
 :major: 0
 :minor: 11
 :patch: 3
-:state: rc
+:state: rails
 :build: 0
 :name: Antares

From 9da1d44d45339fc06ec60b6a43d271977bf05436 Mon Sep 17 00:00:00 2001
From: Scott Davis <jetviper21@gmail.com>
Date: Mon, 27 Jun 2011 00:59:08 -0400
Subject: [PATCH 8/9] merge

---
 Gemfile.lock | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Gemfile.lock b/Gemfile.lock
index 319f703a..acc0bc9c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -7,7 +7,7 @@ GIT
 PATH
   remote: .
   specs:
-    compass (0.11.3.b352e8b)
+    compass (0.11.3.rails.0.642d0b2)
       chunky_png (~> 1.2)
       fssm (>= 0.2.7)
       sass (~> 3.1)

From a08d0319d03409e1619d088cef21c5781063c8b3 Mon Sep 17 00:00:00 2001
From: Caged <justin@labratrevenge.com>
Date: Sat, 2 Jul 2011 13:27:32 -0700
Subject: [PATCH 9/9] Fixes #449.  Accept and honor offsets in selectors

---
 Gemfile.lock                                  |  2 +-
 .../compass/utilities/sprites/_base.scss      | 10 +++----
 .../sass_extensions/functions/sprites.rb      |  2 +-
 lib/compass/sprite_importer.rb                |  8 ++---
 test/integrations/sprites_test.rb             | 30 +++++++++++++++++--
 5 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/Gemfile.lock b/Gemfile.lock
index ab6f3cba..5b86ed71 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -7,7 +7,7 @@ GIT
 PATH
   remote: .
   specs:
-    compass (0.11.3.rails.0.dfb7c70)
+    compass (0.11.3.rails.0.2124003)
       chunky_png (~> 1.2)
       fssm (>= 0.2.7)
       sass (~> 3.1)
diff --git a/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss b/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss
index c346e181..1b268a84 100644
--- a/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss
+++ b/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss
@@ -30,18 +30,18 @@ $disable-magic-sprite-selectors:false !default;
     @include sprite-dimensions($map, $sprite);
   }
   @if not $disable-magic-sprite-selectors {
-    @include sprite-selectors($map, $sprite, $sprite);
+    @include sprite-selectors($map, $sprite, $sprite, $offset-x, $offset-y);
   }
 }
 
 // Include the selectors for the `$sprite` given the `$map` and the 
 // `$full-sprite-name`
 // @private
-@mixin sprite-selectors($map, $sprite-name, $full-sprite-name) {
+@mixin sprite-selectors($map, $sprite-name, $full-sprite-name, $offset-x: 0, $offset-y: 0) {
   @each $selector in $sprite-selectors {
     @if sprite_has_selector($map, $sprite-name, $selector) {
       &:#{$selector}, &.#{$full-sprite-name}_#{$selector}, &.#{$full-sprite-name}-#{$selector} {
-          @include sprite-background-position($map, "#{$sprite-name}_#{$selector}");
+          @include sprite-background-position($map, "#{$sprite-name}_#{$selector}", $offset-x, $offset-y);
       }
     }
   }
@@ -53,13 +53,13 @@ $disable-magic-sprite-selectors:false !default;
 // If a base class is provided, then each class will extend it.
 //
 // If `$dimensions` is `true`, the sprite dimensions will specified.
-@mixin sprites($map, $sprite-names, $base-class: false, $dimensions: false, $prefix: sprite-map-name($map)) {
+@mixin sprites($map, $sprite-names, $base-class: false, $dimensions: false, $prefix: sprite-map-name($map), $offset-x: 0, $offset-y: 0) {
   @each $sprite-name in $sprite-names {
     @if sprite_does_not_have_parent($map, $sprite-name) {
       $full-sprite-name: "#{$prefix}-#{$sprite-name}";
       .#{$full-sprite-name} {
         @if $base-class { @extend #{$base-class}; }
-        @include sprite($map, $sprite-name, $dimensions);
+        @include sprite($map, $sprite-name, $dimensions, $offset-x, $offset-y);
       }
     }
   }
diff --git a/lib/compass/sass_extensions/functions/sprites.rb b/lib/compass/sass_extensions/functions/sprites.rb
index 7639f4da..d006d3ee 100644
--- a/lib/compass/sass_extensions/functions/sprites.rb
+++ b/lib/compass/sass_extensions/functions/sprites.rb
@@ -34,7 +34,7 @@ module Compass::SassExtensions::Functions::Sprites
   #
   #     background: url('/images/icons.png?12345678') 0 -24px no-repeat;
   def sprite(map, sprite, offset_x = ZERO, offset_y = ZERO)
-    sprite = convert_sprite_name(sprite)
+    sprite = convert_sprite_name(sprite)    
     verify_map(map)
     unless sprite.is_a?(Sass::Script::String)
       raise Sass::SyntaxError, %Q(The second argument to sprite() must be a sprite name. See http://beta.compass-style.org/help/tutorials/spriting/ for more information.)
diff --git a/lib/compass/sprite_importer.rb b/lib/compass/sprite_importer.rb
index d46403d9..1bda1162 100644
--- a/lib/compass/sprite_importer.rb
+++ b/lib/compass/sprite_importer.rb
@@ -132,13 +132,13 @@ $#{name}-layout:vertical !default;
   @include sprite($#{name}-sprites, $name, $dimensions, $offset-x, $offset-y)
 }
 
-@mixin #{name}-sprites($sprite-names, $dimensions: $#{name}-sprite-dimensions, $prefix: sprite-map-name($#{name}-sprites)) {
-  @include sprites($#{name}-sprites, $sprite-names, $#{name}-sprite-base-class, $dimensions, $prefix)
+@mixin #{name}-sprites($sprite-names, $dimensions: $#{name}-sprite-dimensions, $prefix: sprite-map-name($#{name}-sprites), $offset-x: 0, $offset-y: 0) {
+  @include sprites($#{name}-sprites, $sprite-names, $#{name}-sprite-base-class, $dimensions, $prefix, $offset-x, $offset-y)
 }
 
 // Generates a class for each sprited image.
-@mixin all-#{name}-sprites($dimensions: $#{name}-sprite-dimensions, $prefix: sprite-map-name($#{name}-sprites)) {
-  @include #{name}-sprites(#{sprite_names(uri).join(" ")}, $dimensions, $prefix);
+@mixin all-#{name}-sprites($dimensions: $#{name}-sprite-dimensions, $prefix: sprite-map-name($#{name}-sprites), $offset-x: 0, $offset-y: 0) {
+  @include #{name}-sprites(#{sprite_names(uri).join(" ")}, $dimensions, $prefix, $offset-x, $offset-y);
 }
 SCSS
     end
diff --git a/test/integrations/sprites_test.rb b/test/integrations/sprites_test.rb
index 6f6834bd..9e69f703 100644
--- a/test/integrations/sprites_test.rb
+++ b/test/integrations/sprites_test.rb
@@ -448,7 +448,7 @@ class SpritesTest < Test::Unit::TestCase
     CSS
   end
 
-  it "should render corret sprite with css selectors via issue#248" do
+  it "should render correct sprite with css selectors via issue#248" do
     css = render <<-SCSS
       @import "selectors/*.png";
       @include all-selectors-sprites;
@@ -472,8 +472,33 @@ class SpritesTest < Test::Unit::TestCase
       }
     CSS
   end
+  
+  it "should honor offsets when rendering selectors via issue#449" do
+    css = render <<-SCSS
+      @import "selectors/*.png";
+      @include all-selectors-sprites($offset-x: 20px, $offset-y: 20px);
+    SCSS
+    assert_correct css, <<-CSS
+      .selectors-sprite, .selectors-ten-by-ten {
+        background: url('/selectors-sedfef809e2.png') no-repeat;
+      }
+      
+      .selectors-ten-by-ten {
+        background-position: 20px 20px;
+      }
+      .selectors-ten-by-ten:hover, .selectors-ten-by-ten.ten-by-ten_hover, .selectors-ten-by-ten.ten-by-ten-hover {
+        background-position: 20px 0;
+      }
+      .selectors-ten-by-ten:target, .selectors-ten-by-ten.ten-by-ten_target, .selectors-ten-by-ten.ten-by-ten-target {
+        background-position: 20px -10px;
+      }
+      .selectors-ten-by-ten:active, .selectors-ten-by-ten.ten-by-ten_active, .selectors-ten-by-ten.ten-by-ten-active {
+        background-position: 20px 10px;
+      }
+    CSS
+  end
 
-  it "should render corret sprite with css selectors via magic mixin" do
+  it "should render correct sprite with css selectors via magic mixin" do
     css = render <<-SCSS
       @import "selectors/*.png";
       a {
@@ -499,6 +524,7 @@ class SpritesTest < Test::Unit::TestCase
       }
     CSS
   end
+
   
   it "should not render corret sprite with css selectors via magic mixin" do
     css = render <<-SCSS