class Sass::Rails::SassTemplate - sass-rails-5.0.3 Documentation

# class Sass::Rails::SassTemplate

### Public Class Methods

default_mime_type() click to toggle source

    # File lib/sass/rails/template.rb, line 10
    def self.default_mime_type
      'text/css'
    end

engine_initialized?() click to toggle source

    # File lib/sass/rails/template.rb, line 14
    def self.engine_initialized?
      true
    end

### Public Instance Methods

evaluate(context, locals, &block) click to toggle source

    # File lib/sass/rails/template.rb, line 28
    def evaluate(context, locals, &block)
      cache_store = CacheStore.new(context.environment)

      options = {
        :filename => eval_file,
        :line => line,
        :syntax => syntax,
        :cache_store => cache_store,
        :importer => importer_class.new(context.pathname.to_s),
        :load_paths => context.environment.paths.map { |path| importer_class.new(path.to_s) },
        :sprockets => {
          :context => context,
          :environment => context.environment
        }
      }

      sass_config = context.sass_config.merge(options)

      engine = ::Sass::Engine.new(data, sass_config)
      css = engine.render

      engine.dependencies.map do |dependency|
        context.depend_on(dependency.options[:filename])
      end

      css
    rescue ::Sass::SyntaxError => e
      context.__LINE__ = e.sass_backtrace.first[:line]
      raise e
    end

initialize_engine() click to toggle source

    # File lib/sass/rails/template.rb, line 18
    def initialize_engine
    end

prepare() click to toggle source

    # File lib/sass/rails/template.rb, line 21
    def prepare
    end

syntax() click to toggle source

    # File lib/sass/rails/template.rb, line 24
    def syntax
      :sass
    end

### Private Instance Methods

importer_class() click to toggle source

    # File lib/sass/rails/template.rb, line 61
    def importer_class
      SassImporter
    end