Class: Sprockets::SassCompressor

Inherits:
Object
  • Object
show all
Defined in:
lib/sassc/rails/compressor.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SassCompressor

Returns a new instance of SassCompressor.



8
9
10
11
12
13
14
15
16
# File 'lib/sassc/rails/compressor.rb', line 8

def initialize(options = {})
  @options = {
    syntax: :scss,
    cache: false,
    read_cache: false,
    style: :compressed
  }.merge(options).freeze
  @cache_key = SecureRandom.uuid
end

Instance Method Details

#call(*args) ⇒ Object Also known as: evaluate



18
19
20
21
22
23
24
25
26
# File 'lib/sassc/rails/compressor.rb', line 18

def call(*args)
  input = if defined?(data)
            data # sprockets 2.x
          else
            args[0][:data] # sprockets 3.x
          end

  SassC::Engine.new(input, { style: :compressed }).render
end