sprockets-sass 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -55,7 +55,18 @@ module Sass
55
55
  # background: asset-url("image.jpg"); // background: url("/assets/image.jpg");
56
56
  # background: asset-url("image.jpg", $digest: true); // background: url("/assets/image-27a8f1f96afd8d4c67a59eb9447f45bd.jpg");
57
57
  #
58
- def image_url(source, options = {})
58
+ def image_url(source, options = {}, cache_buster = nil)
59
+ # Check for the Compass #image_url API,
60
+ # and work with it. We don't want to break
61
+ # the Compass mixins that expect it.
62
+ if options.respond_to? :value
63
+ case options.value
64
+ when true
65
+ return image_path source
66
+ else
67
+ options = {}
68
+ end
69
+ end
59
70
  Script::String.new "url(#{image_path(source, options)})"
60
71
  end
61
72
  declare :image_url, [:source], :var_kwargs => true
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module Sass
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
@@ -206,4 +206,15 @@ describe Sprockets::Sass do
206
206
  @env["image_path_options.css"].to_s.should =~ %r(body \{\n background: url\("/themes/image-[0-9a-f]+.jpg"\); \}\n)
207
207
  @env["image_url_options.css"].to_s.should =~ %r(body \{\n background: url\("/themes/image-[0-9a-f]+.jpg"\); \}\n)
208
208
  end
209
+
210
+ it "doesn't break Compass's #image_url helper" do
211
+ @assets.file "image_path.css.scss", %(body { background: url(image-url("image.jpg", true)); })
212
+ @assets.file "image_url.css.scss", %(body { background: image-url("image.jpg", false); })
213
+ @assets.file "cache_buster.css.scss", %(body { background: image-url("image.jpg", false, true); })
214
+ @assets.file "image.jpg"
215
+
216
+ @env["image_path.css"].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
217
+ @env["image_url.css"].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
218
+ @env["cache_buster.css"].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
219
+ end
209
220
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-sass
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pete Browne
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-02 00:00:00 Z
18
+ date: 2011-11-14 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement
@@ -29,8 +29,8 @@ dependencies:
29
29
  - 0
30
30
  version: "2.0"
31
31
  name: sprockets
32
- version_requirements: *id001
33
32
  prerelease: false
33
+ version_requirements: *id001
34
34
  type: :runtime
35
35
  - !ruby/object:Gem::Dependency
36
36
  requirement: &id002 !ruby/object:Gem::Requirement
@@ -44,8 +44,8 @@ dependencies:
44
44
  - 1
45
45
  version: "0.1"
46
46
  name: sprockets-helpers
47
- version_requirements: *id002
48
47
  prerelease: false
48
+ version_requirements: *id002
49
49
  type: :runtime
50
50
  - !ruby/object:Gem::Dependency
51
51
  requirement: &id003 !ruby/object:Gem::Requirement
@@ -59,8 +59,8 @@ dependencies:
59
59
  - 1
60
60
  version: "1.1"
61
61
  name: tilt
62
- version_requirements: *id003
63
62
  prerelease: false
63
+ version_requirements: *id003
64
64
  type: :runtime
65
65
  - !ruby/object:Gem::Dependency
66
66
  requirement: &id004 !ruby/object:Gem::Requirement
@@ -74,8 +74,8 @@ dependencies:
74
74
  - 6
75
75
  version: "2.6"
76
76
  name: rspec
77
- version_requirements: *id004
78
77
  prerelease: false
78
+ version_requirements: *id004
79
79
  type: :development
80
80
  - !ruby/object:Gem::Dependency
81
81
  requirement: &id005 !ruby/object:Gem::Requirement
@@ -89,8 +89,8 @@ dependencies:
89
89
  - 2
90
90
  version: "1.2"
91
91
  name: test-construct
92
- version_requirements: *id005
93
92
  prerelease: false
93
+ version_requirements: *id005
94
94
  type: :development
95
95
  - !ruby/object:Gem::Dependency
96
96
  requirement: &id006 !ruby/object:Gem::Requirement
@@ -104,8 +104,8 @@ dependencies:
104
104
  - 1
105
105
  version: "3.1"
106
106
  name: sass
107
- version_requirements: *id006
108
107
  prerelease: false
108
+ version_requirements: *id006
109
109
  type: :development
110
110
  - !ruby/object:Gem::Dependency
111
111
  requirement: &id007 !ruby/object:Gem::Requirement
@@ -119,8 +119,8 @@ dependencies:
119
119
  - 11
120
120
  version: "0.11"
121
121
  name: compass
122
- version_requirements: *id007
123
122
  prerelease: false
123
+ version_requirements: *id007
124
124
  type: :development
125
125
  - !ruby/object:Gem::Dependency
126
126
  requirement: &id008 !ruby/object:Gem::Requirement
@@ -133,8 +133,8 @@ dependencies:
133
133
  - 0
134
134
  version: "0"
135
135
  name: rake
136
- version_requirements: *id008
137
136
  prerelease: false
137
+ version_requirements: *id008
138
138
  type: :development
139
139
  description: When using Sprockets 2.0 with Sass you will eventually run into a pretty big issue. `//= require` directives will not allow Sass mixins, variables, etc. to be shared between files. So you'll try to use `@import`, and that'll also blow up in your face. `sprockets-sass` fixes all of this by creating a Sass::Importer that is Sprockets aware.
140
140
  email: