sass-rails 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -59,6 +59,8 @@ The [list of supported options](http://sass-lang.com/docs/yardoc/file.SASS_REFER
59
59
  For example: `image_url("rails.png")` becomes `url(/assets/rails.png)` and
60
60
  `image_path("rails.png")` becomes `"/assets/rails.png"`.
61
61
 
62
+ * `asset_data_url($relative-asset-path)` - Returns url reference to the Base64-encoded asset at the specified path.
63
+ For example: `asset-data-url("rails.png")` becomes `url(data:image/png;base64,iVBORw0K...)`
62
64
 
63
65
  ## Running Tests
64
66
 
@@ -2,6 +2,11 @@ module Sass
2
2
  module Rails
3
3
  module Helpers
4
4
 
5
+ def asset_data_url(path)
6
+ data = context_asset_data_uri(path.value)
7
+ Sass::Script::String.new(%Q{url(#{data})})
8
+ end
9
+
5
10
  def asset_path(asset, kind)
6
11
  Sass::Script::String.new(public_path(asset.value, kind.value), true)
7
12
  end
@@ -25,6 +30,10 @@ module Sass
25
30
  def public_path(asset, kind)
26
31
  options[:custom][:resolver].public_path(asset, kind.pluralize)
27
32
  end
33
+
34
+ def context_asset_data_uri(path)
35
+ options[:custom][:resolver].context.asset_data_uri(path)
36
+ end
28
37
  end
29
38
  end
30
39
  end
@@ -1,5 +1,5 @@
1
1
  module Sass
2
2
  module Rails
3
- VERSION = "3.1.1"
3
+ VERSION = "3.1.2"
4
4
  end
5
5
  end
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.add_runtime_dependency 'railties', '~> 3.1.0'
19
19
  s.add_runtime_dependency 'actionpack', '~> 3.1.0'
20
20
  s.add_runtime_dependency 'tilt', '~> 1.3.2'
21
+ s.add_runtime_dependency 'sprockets', '~> 2.0.0'
21
22
 
22
23
  s.files = `git ls-files`.split("\n")
23
24
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,6 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', "~> 3.1.0.rc4"
3
+ gem 'rails', "~> 3.1.0"
4
4
  gem 'sqlite3'
5
5
 
6
6
  # Asset template engines
@@ -1,6 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', "~> 3.1.0.rc4"
3
+ gem 'rails', "~> 3.1.0"
4
4
  gem 'sqlite3'
5
5
 
6
6
  # Asset template engines
@@ -1,6 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', "~> 3.1.0.rc4"
3
+ gem 'rails', "~> 3.1.0"
4
4
  gem 'sqlite3'
5
5
 
6
6
  # Asset template engines
@@ -14,6 +14,7 @@
14
14
  asset-path: asset-path("rails.png", image);
15
15
  asset-url: asset-url("rails.png", image);
16
16
  image-url: image-url("rails.png");
17
+ asset-data-url: asset-data-url("1x1.png");
17
18
  }
18
19
 
19
20
  @include without-css-ext;
@@ -77,6 +77,12 @@ class SassRailsTest < Sass::Rails::TestCase
77
77
  assert_match css_output, %r{asset-path:\s*"/assets/rails.png"}, 'asset-path:\s*"/assets/rails.png"'
78
78
  assert_match css_output, %r{asset-url:\s*url\(/assets/rails.png\)}, 'asset-url:\s*url\(/assets/rails.png\)'
79
79
  assert_match css_output, %r{image-url:\s*url\(/assets/rails.png\)}, 'image-url:\s*url\(/assets/rails.png\)'
80
+
81
+ asset_data_url_regexp = %r{asset-data-url:\s*url\((.*?)\)}
82
+ assert_match css_output, asset_data_url_regexp, 'asset-data-url:\s*url\((.*?)\)'
83
+ asset_data_url_match = css_output.match(asset_data_url_regexp)[1]
84
+ asset_data_url_expected = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0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compressor compresses" do
82
88
  assert_equal "div{color:red}\n", Sass::Rails::CssCompressor.new.compress(<<CSS)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sass-rails
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.1.1
5
+ version: 3.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - wycats
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-09-13 00:00:00 -07:00
14
+ date: 2011-09-15 00:00:00 -07:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -58,6 +58,17 @@ dependencies:
58
58
  version: 1.3.2
59
59
  type: :runtime
60
60
  version_requirements: *id004
61
+ - !ruby/object:Gem::Dependency
62
+ name: sprockets
63
+ prerelease: false
64
+ requirement: &id005 !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 2.0.0
70
+ type: :runtime
71
+ version_requirements: *id005
61
72
  description: Sass adapter for the Rails asset pipeline.
62
73
  email:
63
74
  - wycats@gmail.com
@@ -183,6 +194,7 @@ files:
183
194
  - test/fixtures/scss_project/Gemfile
184
195
  - test/fixtures/scss_project/README
185
196
  - test/fixtures/scss_project/Rakefile
197
+ - test/fixtures/scss_project/app/assets/images/1x1.png
186
198
  - test/fixtures/scss_project/app/assets/images/rails.png
187
199
  - test/fixtures/scss_project/app/assets/javascripts/application.js
188
200
  - test/fixtures/scss_project/app/assets/stylesheets/_top_level_partial.css.scss
@@ -358,6 +370,7 @@ test_files:
358
370
  - test/fixtures/scss_project/Gemfile
359
371
  - test/fixtures/scss_project/README
360
372
  - test/fixtures/scss_project/Rakefile
373
+ - test/fixtures/scss_project/app/assets/images/1x1.png
361
374
  - test/fixtures/scss_project/app/assets/images/rails.png
362
375
  - test/fixtures/scss_project/app/assets/javascripts/application.js
363
376
  - test/fixtures/scss_project/app/assets/stylesheets/_top_level_partial.css.scss