sprockets-sass 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,19 @@ module Sprockets
14
14
  # background: url(asset-path("image.jpg", $digest: true)); // background: url("/assets/image-27a8f1f96afd8d4c67a59eb9447f45bd.jpg");
15
15
  #
16
16
  def asset_path(source, options = {})
17
- ::Sass::Script::String.new context.asset_path(source.value, map_options(options)), :string
17
+ # Check for the Sass::Rails' #asset_path API,
18
+ # and work with it. We want to make Rails assets work
19
+ # just fine with Machined.
20
+ if options.respond_to? :value
21
+ kind = options.value
22
+ options = {}
23
+ end
24
+
25
+ if kind && context.respond_to?("#{kind}_path")
26
+ ::Sass::Script::String.new context.send("#{kind}_path", source.value), :string
27
+ else
28
+ ::Sass::Script::String.new context.asset_path(source.value, map_options(options)), :string
29
+ end
18
30
  end
19
31
 
20
32
  # Using Sprockets::Helpers#asset_path, return the url CSS
@@ -89,11 +101,18 @@ end
89
101
  module Sass::Script::Functions
90
102
  include Sprockets::Sass::Functions
91
103
 
92
- # Hack to ensure the Compass API signatures don't take precedence
93
- @signatures[:image_url] = []
104
+ # Hack to ensure previous API declarations (by Compass or whatever)
105
+ # don't take precedence.
106
+ [:asset_path, :asset_url, :image_path, :image_url].each do |method|
107
+ defined?(@signatures) && @signatures.delete(method)
108
+ end
94
109
 
95
110
  declare :asset_path, [:source], :var_kwargs => true
111
+ declare :asset_path, [:source, :kind]
96
112
  declare :asset_url, [:source], :var_kwargs => true
113
+ declare :asset_url, [:source, :kind]
97
114
  declare :image_path, [:source], :var_kwargs => true
98
- declare :image_url, [:source], :var_kwargs => true, :var_args => true
115
+ declare :image_url, [:source], :var_kwargs => true
116
+ declare :image_url, [:source, :only_path]
117
+ declare :image_url, [:source, :only_path, :cache_buster]
99
118
  end
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module Sass
3
- VERSION = "0.5.0"
3
+ VERSION = "0.5.1"
4
4
  end
5
5
  end
@@ -207,7 +207,7 @@ describe Sprockets::Sass do
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
209
 
210
- it "doesn't break Compass's #image_url helper" do
210
+ it "mirrors Compass's #image_url helper" do
211
211
  @assets.file "image_path.css.scss", %(body { background: url(image-url("image.jpg", true)); })
212
212
  @assets.file "image_url.css.scss", %(body { background: image-url("image.jpg", false); })
213
213
  @assets.file "cache_buster.css.scss", %(body { background: image-url("image.jpg", false, true); })
@@ -217,4 +217,13 @@ describe Sprockets::Sass do
217
217
  @env["image_url.css"].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
218
218
  @env["cache_buster.css"].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
219
219
  end
220
+
221
+ it "mirrors Sass::Rails's #asset_path helpers" do
222
+ @assets.file "asset_path.css.scss", %(body { background: url(asset-path("image.jpg", image)); })
223
+ @assets.file "asset_url.css.scss", %(body { background: asset-url("icon.jpg", image); })
224
+ @assets.file "image.jpg"
225
+
226
+ @env["asset_path.css"].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
227
+ @env["asset_url.css"].to_s.should == %(body {\n background: url("/images/icon.jpg"); }\n)
228
+ end
220
229
  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: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pete Browne
@@ -15,9 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-29 00:00:00 Z
18
+ date: 2011-12-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
+ type: :runtime
21
22
  requirement: &id001 !ruby/object:Gem::Requirement
22
23
  none: false
23
24
  requirements:
@@ -28,11 +29,11 @@ dependencies:
28
29
  - 2
29
30
  - 0
30
31
  version: "2.0"
31
- name: sprockets
32
32
  prerelease: false
33
+ name: sprockets
33
34
  version_requirements: *id001
34
- type: :runtime
35
35
  - !ruby/object:Gem::Dependency
36
+ type: :runtime
36
37
  requirement: &id002 !ruby/object:Gem::Requirement
37
38
  none: false
38
39
  requirements:
@@ -43,11 +44,11 @@ dependencies:
43
44
  - 1
44
45
  - 1
45
46
  version: "1.1"
46
- name: tilt
47
47
  prerelease: false
48
+ name: tilt
48
49
  version_requirements: *id002
49
- type: :runtime
50
50
  - !ruby/object:Gem::Dependency
51
+ type: :development
51
52
  requirement: &id003 !ruby/object:Gem::Requirement
52
53
  none: false
53
54
  requirements:
@@ -58,11 +59,11 @@ dependencies:
58
59
  - 0
59
60
  - 4
60
61
  version: "0.4"
61
- name: appraisal
62
62
  prerelease: false
63
+ name: appraisal
63
64
  version_requirements: *id003
64
- type: :development
65
65
  - !ruby/object:Gem::Dependency
66
+ type: :development
66
67
  requirement: &id004 !ruby/object:Gem::Requirement
67
68
  none: false
68
69
  requirements:
@@ -73,11 +74,11 @@ dependencies:
73
74
  - 2
74
75
  - 6
75
76
  version: "2.6"
76
- name: rspec
77
77
  prerelease: false
78
+ name: rspec
78
79
  version_requirements: *id004
79
- type: :development
80
80
  - !ruby/object:Gem::Dependency
81
+ type: :development
81
82
  requirement: &id005 !ruby/object:Gem::Requirement
82
83
  none: false
83
84
  requirements:
@@ -88,11 +89,11 @@ dependencies:
88
89
  - 1
89
90
  - 2
90
91
  version: "1.2"
91
- name: test-construct
92
92
  prerelease: false
93
+ name: test-construct
93
94
  version_requirements: *id005
94
- type: :development
95
95
  - !ruby/object:Gem::Dependency
96
+ type: :development
96
97
  requirement: &id006 !ruby/object:Gem::Requirement
97
98
  none: false
98
99
  requirements:
@@ -103,11 +104,11 @@ dependencies:
103
104
  - 0
104
105
  - 2
105
106
  version: "0.2"
106
- name: sprockets-helpers
107
107
  prerelease: false
108
+ name: sprockets-helpers
108
109
  version_requirements: *id006
109
- type: :development
110
110
  - !ruby/object:Gem::Dependency
111
+ type: :development
111
112
  requirement: &id007 !ruby/object:Gem::Requirement
112
113
  none: false
113
114
  requirements:
@@ -118,11 +119,11 @@ dependencies:
118
119
  - 3
119
120
  - 1
120
121
  version: "3.1"
121
- name: sass
122
122
  prerelease: false
123
+ name: sass
123
124
  version_requirements: *id007
124
- type: :development
125
125
  - !ruby/object:Gem::Dependency
126
+ type: :development
126
127
  requirement: &id008 !ruby/object:Gem::Requirement
127
128
  none: false
128
129
  requirements:
@@ -133,11 +134,11 @@ dependencies:
133
134
  - 0
134
135
  - 11
135
136
  version: "0.11"
136
- name: compass
137
137
  prerelease: false
138
+ name: compass
138
139
  version_requirements: *id008
139
- type: :development
140
140
  - !ruby/object:Gem::Dependency
141
+ type: :development
141
142
  requirement: &id009 !ruby/object:Gem::Requirement
142
143
  none: false
143
144
  requirements:
@@ -147,10 +148,9 @@ dependencies:
147
148
  segments:
148
149
  - 0
149
150
  version: "0"
150
- name: rake
151
151
  prerelease: false
152
+ name: rake
152
153
  version_requirements: *id009
153
- type: :development
154
154
  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.
155
155
  email:
156
156
  - me@petebrowne.com
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  requirements: []
212
212
 
213
213
  rubyforge_project: sprockets-sass
214
- rubygems_version: 1.8.5
214
+ rubygems_version: 1.8.11
215
215
  signing_key:
216
216
  specification_version: 3
217
217
  summary: Better Sass integration with Sprockets 2.0