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.



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

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



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

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