class Sass::Importers::Rails
as well as the controller prefix for the view being generated.
It contains the ActionView::LookupContext for that request,
Each importer instance is local to a single request for a single view.
and failing that will fall back on a partial.
they will first attempt to find a non-partial file,
Imports within Rails behave more like Sass imports:
as a distinct action from importing other Sass files.
in that Sass doesn’t have a concept of importing partials
This is different from standard Rails rendering
Currently doesn’t support caching.
Loads Sass files as though they were views in Rails.
An importer that wraps the Rails 3.1 view infrastructure.
def find(uri, options)
- See: Base#find -
def find(uri, options) find_(uri, nil, options) end
def find_(uri, prefix, options)
def find_(uri, prefix, options) prepare_template( find_template(uri, prefix, !:partial, options) || find_template(uri, prefix, :partial, options), options) end
def find_relative(uri, base, options)
- See: Base#find_relative -
def find_relative(uri, base, options) find_(uri, base.split('/')[0...-1].join('/'), options) end
def find_template(uri, prefix, partial, options)
def find_template(uri, prefix, partial, options) return options[:_rails_lookup_context]. find_all(uri, prefix, partial). find {|t| t.handler.is_a?(Sass::Plugin::TemplateHandler)} end
def initialize; end
def initialize; end
def key(uri, options)
- See: Base#key -
def key(uri, options) [self.class.name + ":" + uri.split('/')[0...-1].join('/'), uri.split('/')[-1] + "." + options[:syntax].to_s] end
def mtime(uri, options)
- See: Base#mtime -
def mtime(uri, options) return unless template = find_template(uri, nil, !:partial, options) || find_template(uri, nil, :partial, options) template.updated_at end
def prepare_template(template, options)
def prepare_template(template, options) return unless template options[:syntax] = template.handler.syntax options[:filename] = template.virtual_path options[:_rails_filename] = template.identifier options[:importer] = self Sass::Engine.new(template.source, options) end
def to_s
- See: Base#to_s -
def to_s "(Rails importer)" end