sass 3.1.0.alpha.40 → 3.1.0.alpha.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 3.1.0.alpha.40
1
+ 3.1.0.alpha.41
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.0.alpha.40
1
+ 3.1.0.alpha.41
@@ -16,11 +16,7 @@ module Sass
16
16
  # as well as the controller prefix for the view being generated.
17
17
  class Rails < Base
18
18
  # Creates a new Rails importer that imports files as Rails views.
19
- #
20
- # @param lookup_context [ActionView::LookupContext] The Rails view finder.
21
- def initialize(lookup_context)
22
- @lookup_context = lookup_context
23
- end
19
+ def initialize; end
24
20
 
25
21
  # @see Base#find_relative
26
22
  def find_relative(uri, base, options)
@@ -35,11 +31,17 @@ module Sass
35
31
  # @see Base#mtime
36
32
  def mtime(uri, options)
37
33
  return unless template =
38
- find_template(uri, nil, !:partial) ||
39
- find_template(uri, nil, :partial)
34
+ find_template(uri, nil, !:partial, options) ||
35
+ find_template(uri, nil, :partial, options)
40
36
  template.updated_at
41
37
  end
42
38
 
39
+ # @see Base#key
40
+ def key(uri, options)
41
+ [self.class.name + ":" + uri.split('/')[0...-1].join('/'),
42
+ uri.split('/')[-1] + "." + options[:syntax].to_s]
43
+ end
44
+
43
45
  # @see Base#to_s
44
46
  def to_s
45
47
  "(Rails importer)"
@@ -49,13 +51,13 @@ module Sass
49
51
 
50
52
  def find_(uri, prefix, options)
51
53
  prepare_template(
52
- find_template(uri, prefix, !:partial) ||
53
- find_template(uri, prefix, :partial),
54
+ find_template(uri, prefix, !:partial, options) ||
55
+ find_template(uri, prefix, :partial, options),
54
56
  options)
55
57
  end
56
58
 
57
- def find_template(uri, prefix, partial)
58
- return @lookup_context.
59
+ def find_template(uri, prefix, partial, options)
60
+ return options[:_rails_lookup_context].
59
61
  find_all(uri, prefix, partial).
60
62
  find {|t| t.handler.is_a?(Sass::Plugin::TemplateHandler)}
61
63
  end
@@ -6,7 +6,8 @@ unless defined?(Sass::RAILS_LOADED)
6
6
  def default_options
7
7
  opts = {
8
8
  :quiet => Sass::Util.rails_env != "production",
9
- :full_exception => Sass::Util.rails_env != "production"
9
+ :full_exception => Sass::Util.rails_env != "production",
10
+ :cache_location => Sass::Util.rails_root + '/tmp/sass-cache'
10
11
  }
11
12
 
12
13
  if Sass::Util.ap_geq?('3.1.0.beta')
@@ -16,7 +17,6 @@ unless defined?(Sass::RAILS_LOADED)
16
17
  :always_update => false,
17
18
  :template_location => Sass::Util.rails_root + '/public/stylesheets/sass',
18
19
  :css_location => Sass::Util.rails_root + '/public/stylesheets',
19
- :cache_location => Sass::Util.rails_root + '/tmp/sass-cache',
20
20
  :always_check => Sass::Util.rails_env == "development")
21
21
  end
22
22
 
@@ -40,14 +40,13 @@ unless defined?(Sass::RAILS_LOADED)
40
40
  def handles_encoding?; true; end
41
41
 
42
42
  def call(template, view)
43
- rails_importer = Sass::Importers::Rails.new(view.lookup_context)
44
43
  engine = Sass::Engine.new(template.source,
45
44
  Sass::Plugin.engine_options.merge(
46
- :cache => false,
47
45
  :syntax => @syntax,
48
46
  :filename => template.virtual_path,
49
- :importer => rails_importer,
50
- :load_paths => [rails_importer] + Sass::Plugin.engine_options[:load_paths]))
47
+ :_rails_lookup_context => view.lookup_context,
48
+ :importer => Sass::Importers::Rails.new,
49
+ :load_paths => [Sass::Importers::Rails.new] + Sass::Plugin.engine_options[:load_paths]))
51
50
 
52
51
  template.data[:sass_importers] = engine.dependencies.map do |e|
53
52
  [e.options[:filename], e.options[:importer]]
@@ -64,7 +63,7 @@ unless defined?(Sass::RAILS_LOADED)
64
63
  <<RUBY
65
64
  begin
66
65
  if Sass::Plugin::TemplateHandler.dependencies_changed?(
67
- @_template.data[:sass_importers], #{Time.now.to_i})
66
+ @_template.data[:sass_importers], #{Time.now.to_i}, lookup_context)
68
67
  @_template.expire!
69
68
  @_template.rerender(self)
70
69
  else
@@ -77,8 +76,8 @@ end
77
76
  RUBY
78
77
  end
79
78
 
80
- def self.dependencies_changed?(deps, since)
81
- opts = Sass::Plugin.engine_options.merge(:cache => false)
79
+ def self.dependencies_changed?(deps, since, lookup_context)
80
+ opts = Sass::Plugin.engine_options.merge(:_rails_lookup_context => lookup_context)
82
81
  deps.any? do |d, i|
83
82
  return true unless time = i.mtime(d, opts)
84
83
  time.to_i > since
@@ -86,8 +85,8 @@ RUBY
86
85
  end
87
86
 
88
87
  def self.munge_exception(e, lookup_context)
89
- importer = Sass::Importers::Rails.new(lookup_context)
90
- opts = Sass::Plugin.engine_options.merge(:cache => false)
88
+ importer = Sass::Importers::Rails.new
89
+ opts = Sass::Plugin.engine_options.merge(:_rails_lookup_context => lookup_context)
91
90
  e.sass_backtrace.each do |bt|
92
91
  next unless engine = importer.find(bt[:filename], opts)
93
92
  bt[:filename] = engine.options[:_rails_filename]
@@ -36,6 +36,25 @@ module Sass::Tree
36
36
  self.else.options = options if self.else
37
37
  end
38
38
 
39
+ # @see Node#_around_dump
40
+ def _around_dump
41
+ old_else = @else
42
+ old_last_else = @last_else
43
+ @else = Sass::Util.dump(@else)
44
+ @last_else = (self == @last_else ? nil : Sass::Util.dump(@last_else))
45
+ super
46
+ ensure
47
+ @else = old_else
48
+ @last_else = old_last_else
49
+ end
50
+
51
+ # @see Node#_after_load
52
+ def _after_load
53
+ super
54
+ @else = Sass::Util.load(@else)
55
+ @last_else = (@last_else ? Sass::Util.load(@last_else) : self)
56
+ end
57
+
39
58
  protected
40
59
 
41
60
  # @see Node#to_src
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.alpha.40
4
+ version: 3.1.0.alpha.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum