sass-rails 3.1.7 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +0 -6
- data/Gemfile +0 -1
- data/README.markdown +15 -16
- data/lib/sass/rails.rb +10 -6
- data/lib/sass/rails/compressor.rb +5 -9
- data/lib/sass/rails/railtie.rb +1 -6
- data/lib/sass/rails/template_handlers.rb +2 -5
- data/lib/sass/rails/version.rb +1 -1
- data/sass-rails.gemspec +3 -4
- data/test/sass_rails_logger_test.rb +5 -3
- data/test/support/sass_rails_test_case.rb +6 -13
- data/test/test_helper.rb +4 -4
- metadata +15 -52
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
3
|
|
4
|
-
3.1.5.rc.1 (Oct 16, 2011)
|
5
|
-
---------------------
|
6
|
-
* Several bug fixes
|
7
|
-
* Performance and bug fixes when compressing stylesheets
|
8
|
-
* Update dependency to latest sass stable release to fix caching issues.
|
9
|
-
|
10
4
|
3.1.2 (Sept 15, 2011)
|
11
5
|
---------------------
|
12
6
|
|
data/Gemfile
CHANGED
data/README.markdown
CHANGED
@@ -21,12 +21,13 @@ properties that will be passed to Sass.
|
|
21
21
|
config.sass.syntax = :nested
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
### Important Note
|
25
25
|
|
26
26
|
Sprockets provides some directives that are placed inside of comments called `require`, `require_tree`, and
|
27
|
-
`require_self`.
|
28
|
-
|
29
|
-
`sass-rails` has customized to integrate with the
|
27
|
+
`require_self`. **DO NOT USE THEM IN YOUR SASS/SCSS FILES.** They are very primitive and
|
28
|
+
do not work well with Sass files. Instead, use Sass's native `@import`
|
29
|
+
directive which `sass-rails` has customized to integrate with the
|
30
|
+
conventions of your rails projects.
|
30
31
|
|
31
32
|
### Options
|
32
33
|
|
@@ -52,21 +53,19 @@ The [list of supported options](http://sass-lang.com/docs/yardoc/file.SASS_REFER
|
|
52
53
|
cascade ordering for imports that contain styles using this approach.
|
53
54
|
|
54
55
|
* **Asset Helpers**. When using the asset pipeline, paths to assets must be rewritten.
|
55
|
-
When referencing assets use the following asset helpers
|
56
|
+
When referencing assets use the following asset helpers (underscored in Ruby, hyphenated
|
57
|
+
in Sass):
|
56
58
|
|
57
|
-
* `
|
58
|
-
For example: `
|
59
|
-
* `
|
60
|
-
|
61
|
-
For example: `asset_url("rails.png", image)` becomes `url(/assets/rails.png)`
|
59
|
+
* `asset-path($relative-asset-path, $asset-class)` - Returns a string to the asset.
|
60
|
+
For example: `asset-path("rails.png", image)` becomes `"/assets/rails.png"`
|
61
|
+
* `asset-url($relative-asset-path, $asset-class)` - Returns url reference to the asset.
|
62
|
+
For example: `asset-url("rails.png", image)` becomes `url(/assets/rails.png)`
|
62
63
|
* As a convenience, for each of the following asset classes there are
|
63
|
-
corresponding `
|
64
|
+
corresponding `-path` and `-url` helpers:
|
64
65
|
image, font, video, audio, javascript, stylesheet.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
* `asset_data_url($relative-asset-path)` - Returns url reference to the Base64-encoded asset at the specified path.
|
66
|
+
For example: `image-url("rails.png")` becomes `url(/assets/rails.png)` and
|
67
|
+
`image-path("rails.png")` becomes `"/assets/rails.png"`.
|
68
|
+
* `asset-data-url($relative-asset-path)` - Returns url reference to the Base64-encoded asset at the specified path.
|
70
69
|
For example: `asset-data-url("rails.png")` becomes `url(data:image/png;base64,iVBORw0K...)`
|
71
70
|
|
72
71
|
## Running Tests
|
data/lib/sass/rails.rb
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
module Sass
|
2
|
+
autoload :Script, 'sass/rails/helpers'
|
3
|
+
|
2
4
|
module Rails
|
5
|
+
autoload :CssCompressor, 'sass/rails/compressor'
|
6
|
+
autoload :Importer, 'sass/rails/importer'
|
7
|
+
autoload :Logger, 'sass/rails/logger'
|
8
|
+
autoload :Resolver, 'sass/rails/template_handlers'
|
9
|
+
autoload :SassTemplate, 'sass/rails/template_handlers'
|
10
|
+
autoload :ScssTemplate, 'sass/rails/template_handlers'
|
3
11
|
end
|
4
12
|
end
|
5
13
|
|
6
|
-
require 'sass/rails/compressor'
|
7
|
-
require 'sass/rails/logger'
|
8
|
-
require 'sass/rails/railtie'
|
9
|
-
require 'sass/rails/helpers'
|
10
|
-
require 'sass/rails/importer'
|
11
|
-
require 'sass/rails/template_handlers'
|
12
14
|
require 'sass/rails/version'
|
15
|
+
require 'sass/rails/helpers'
|
16
|
+
require 'sass/rails/railtie'
|
@@ -4,15 +4,11 @@ module Sass
|
|
4
4
|
module Rails
|
5
5
|
class CssCompressor
|
6
6
|
def compress(css)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
:style => :compressed).render
|
13
|
-
else
|
14
|
-
css
|
15
|
-
end
|
7
|
+
Sass::Engine.new(css,
|
8
|
+
:syntax => :scss,
|
9
|
+
:cache => false,
|
10
|
+
:read_cache => false,
|
11
|
+
:style => :compressed).render
|
16
12
|
end
|
17
13
|
end
|
18
14
|
end
|
data/lib/sass/rails/railtie.rb
CHANGED
@@ -41,11 +41,6 @@ module Sass::Rails
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
# Remove the sass middleware if it gets inadvertently enabled by applications.
|
45
|
-
config.after_initialize do |app|
|
46
|
-
app.config.middleware.delete(Sass::Plugin::Rack) if defined?(Sass::Plugin::Rack)
|
47
|
-
end
|
48
|
-
|
49
44
|
initializer :setup_sass, :group => :all do |app|
|
50
45
|
# Only emit one kind of syntax because though we have registered two kinds of generators
|
51
46
|
syntax = app.config.sass.preferred_syntax.to_sym
|
@@ -71,7 +66,7 @@ module Sass::Rails
|
|
71
66
|
|
72
67
|
initializer :setup_compression, :group => :all do |app|
|
73
68
|
if app.config.assets.compress
|
74
|
-
|
69
|
+
# Use sass's css_compressor
|
75
70
|
app.config.assets.css_compressor = CssCompressor.new
|
76
71
|
end
|
77
72
|
end
|
@@ -19,7 +19,7 @@ module Sass::Rails
|
|
19
19
|
nil
|
20
20
|
end
|
21
21
|
|
22
|
-
def public_path(path, scope
|
22
|
+
def public_path(path, scope)
|
23
23
|
context.asset_paths.compute_public_path(path, ::Rails.application.config.assets.prefix)
|
24
24
|
end
|
25
25
|
|
@@ -72,17 +72,14 @@ module Sass::Rails
|
|
72
72
|
options = sass_options_from_rails(scope)
|
73
73
|
load_paths = (options[:load_paths] || []).dup
|
74
74
|
load_paths.unshift(importer)
|
75
|
-
resolver = Resolver.new(scope)
|
76
|
-
css_filename = File.join(::Rails.public_path, ::Rails.application.config.assets.prefix, scope.logical_path) + ".css"
|
77
75
|
options.merge(
|
78
76
|
:filename => eval_file,
|
79
|
-
:css_filename => css_filename,
|
80
77
|
:line => line,
|
81
78
|
:syntax => syntax,
|
82
79
|
:importer => importer,
|
83
80
|
:load_paths => load_paths,
|
84
81
|
:custom => {
|
85
|
-
:resolver =>
|
82
|
+
:resolver => Resolver.new(scope)
|
86
83
|
}
|
87
84
|
)
|
88
85
|
end
|
data/lib/sass/rails/version.rb
CHANGED
data/sass-rails.gemspec
CHANGED
@@ -14,10 +14,9 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.rubyforge_project = "sass-rails"
|
16
16
|
|
17
|
-
s.add_runtime_dependency 'sass', '
|
18
|
-
s.add_runtime_dependency 'railties', '~> 3.
|
19
|
-
s.add_runtime_dependency '
|
20
|
-
s.add_runtime_dependency 'tilt', '~> 1.3.2'
|
17
|
+
s.add_runtime_dependency 'sass', '~> 3.1.10'
|
18
|
+
s.add_runtime_dependency 'railties', '~> 3.2.0.beta'
|
19
|
+
s.add_runtime_dependency 'tilt', '~> 1.3'
|
21
20
|
|
22
21
|
s.files = `git ls-files`.split("\n")
|
23
22
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -8,9 +8,11 @@ class SassRailsLoggerTest < Sass::Rails::TestCase
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
[:debug, :warn, :info, :error, :trace].each do |level|
|
12
|
+
test "sending a #{level} message to the sass logger writes to the environment log file" do
|
13
|
+
within_rails_app "scss_project" do
|
14
|
+
app_root = runcmd 'rails runner "print Rails.root"'
|
15
|
+
|
14
16
|
message = "[#{level}]: sass message"
|
15
17
|
runcmd %{rails runner "Sass::logger.log_level = :#{level}; Sass::logger.log(:#{level}, %Q|#{message}|)"}
|
16
18
|
|
@@ -59,16 +59,15 @@ class Sass::Rails::TestCase < ActiveSupport::TestCase
|
|
59
59
|
#
|
60
60
|
# Automatically changes back to the working directory
|
61
61
|
# and removes the temp directory when done.
|
62
|
-
def within_rails_app(name, without_gems = [],
|
62
|
+
def within_rails_app(name, without_gems = [], gem_locations = $gem_locations)
|
63
63
|
sourcedir = File.expand_path("../../fixtures/#{name}", __FILE__)
|
64
64
|
Dir.mktmpdir do |tmpdir|
|
65
65
|
FileUtils.cp_r "#{sourcedir}/.", tmpdir
|
66
66
|
Dir.chdir(tmpdir) do
|
67
|
-
|
67
|
+
gem_locations.each {|name, path| modify_gem_location name, path}
|
68
68
|
without_gems.each {|name| remove_gem name}
|
69
|
-
FileUtils.rm("Gemfile.lock") if File.exist?("Gemfile.lock")
|
70
69
|
runcmd "bundle install --verbose"
|
71
|
-
yield
|
70
|
+
yield
|
72
71
|
end
|
73
72
|
end
|
74
73
|
end
|
@@ -82,29 +81,23 @@ class Sass::Rails::TestCase < ActiveSupport::TestCase
|
|
82
81
|
end
|
83
82
|
end
|
84
83
|
|
85
|
-
def
|
84
|
+
def modify_gem_location(gemname, path, gemfile = "Gemfile")
|
86
85
|
found = false
|
87
86
|
process_gemfile(gemfile) do |line|
|
88
87
|
if line =~ /gem *(["'])#{Regexp.escape(gemname)}\1/
|
89
88
|
found = true
|
90
|
-
|
89
|
+
%Q{gem "#{gemname}", :path => #{path.inspect}\n}
|
91
90
|
else
|
92
91
|
line
|
93
92
|
end
|
94
93
|
end
|
95
94
|
unless found
|
96
95
|
File.open(gemfile, "a") do |f|
|
97
|
-
f.print("
|
96
|
+
f.print(%Q{\ngem "#{gemname}", :path => #{path.inspect}\n})
|
98
97
|
end
|
99
98
|
end
|
100
99
|
end
|
101
100
|
|
102
|
-
def gem_entry(gemname, options)
|
103
|
-
entry = %Q{gem "#{gemname}", "~> #{options[:version]}"}
|
104
|
-
entry += ", :path => #{options[:path].inspect}" if options[:path]
|
105
|
-
entry
|
106
|
-
end
|
107
|
-
|
108
101
|
def remove_gem(gemname)
|
109
102
|
process_gemfile(gemfile) do |line|
|
110
103
|
line unless line =~ /gem *(["'])#{Regexp.escape(gemname)}\1/
|
data/test/test_helper.rb
CHANGED
@@ -12,14 +12,14 @@ Rails.backtrace_cleaner.remove_silencers!
|
|
12
12
|
|
13
13
|
# If developing against local dependencies, this code will ensure they get picked up
|
14
14
|
# in the project fixtures that have their own bundle environment
|
15
|
-
$
|
15
|
+
$gem_locations = {}
|
16
16
|
possible_dev_dependencies = %w(sass-rails sass rails actionpack railties sprockets)
|
17
17
|
Bundler.load.specs.each do |s|
|
18
18
|
if possible_dev_dependencies.include?(s.name)
|
19
19
|
gem_path = s.full_gem_path
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
if File.exists?("#{gem_path}/#{s.name}.gemspec")
|
21
|
+
$gem_locations[s.name] = gem_path
|
22
|
+
end
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.2.0
|
4
5
|
prerelease:
|
5
|
-
version: 3.1.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- wycats
|
@@ -10,72 +10,41 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2011-12-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
type: :runtime
|
17
|
-
prerelease: false
|
18
16
|
name: sass
|
19
|
-
|
20
|
-
none: false
|
21
|
-
requirements:
|
22
|
-
- - ! '>='
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: 3.1.10
|
25
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirement: &2152738300 !ruby/object:Gem::Requirement
|
26
18
|
none: false
|
27
19
|
requirements:
|
28
|
-
- -
|
20
|
+
- - ~>
|
29
21
|
- !ruby/object:Gem::Version
|
30
22
|
version: 3.1.10
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
23
|
type: :runtime
|
33
24
|
prerelease: false
|
25
|
+
version_requirements: *2152738300
|
26
|
+
- !ruby/object:Gem::Dependency
|
34
27
|
name: railties
|
35
|
-
|
28
|
+
requirement: &2152735040 !ruby/object:Gem::Requirement
|
36
29
|
none: false
|
37
30
|
requirements:
|
38
31
|
- - ~>
|
39
32
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.
|
41
|
-
requirement: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 3.1.0
|
47
|
-
- !ruby/object:Gem::Dependency
|
33
|
+
version: 3.2.0.beta
|
48
34
|
type: :runtime
|
49
35
|
prerelease: false
|
50
|
-
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
|
-
requirements:
|
54
|
-
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 3.1.0
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 3.1.0
|
36
|
+
version_requirements: *2152735040
|
63
37
|
- !ruby/object:Gem::Dependency
|
64
|
-
type: :runtime
|
65
|
-
prerelease: false
|
66
38
|
name: tilt
|
67
|
-
|
39
|
+
requirement: &2152732640 !ruby/object:Gem::Requirement
|
68
40
|
none: false
|
69
41
|
requirements:
|
70
42
|
- - ~>
|
71
43
|
- !ruby/object:Gem::Version
|
72
|
-
version: 1.3
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 1.3.2
|
44
|
+
version: '1.3'
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2152732640
|
79
48
|
description: Sass adapter for the Rails asset pipeline.
|
80
49
|
email:
|
81
50
|
- wycats@gmail.com
|
@@ -265,22 +234,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
265
234
|
requirements:
|
266
235
|
- - ! '>='
|
267
236
|
- !ruby/object:Gem::Version
|
268
|
-
segments:
|
269
|
-
- 0
|
270
|
-
hash: 4507985399140691707
|
271
237
|
version: '0'
|
272
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
273
239
|
none: false
|
274
240
|
requirements:
|
275
241
|
- - ! '>='
|
276
242
|
- !ruby/object:Gem::Version
|
277
|
-
segments:
|
278
|
-
- 0
|
279
|
-
hash: 4507985399140691707
|
280
243
|
version: '0'
|
281
244
|
requirements: []
|
282
245
|
rubyforge_project: sass-rails
|
283
|
-
rubygems_version: 1.8.
|
246
|
+
rubygems_version: 1.8.10
|
284
247
|
signing_key:
|
285
248
|
specification_version: 3
|
286
249
|
summary: Sass adapter for the Rails asset pipeline.
|