Class: Sprockets::Sass::V2::Compressor

Inherits:
Object
  • Object
show all
Defined in:
lib/sprockets/sass/v2/compressor.rb

Overview

Class used to compress CSS files

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.compress(input) ⇒ Object


11
12
13
# File 'lib/sprockets/sass/v2/compressor.rb', line 11

def self.compress(input)
  instance.compress(input)
end

.instanceObject


7
8
9
# File 'lib/sprockets/sass/v2/compressor.rb', line 7

def self.instance
  @instance ||= new
end

Instance Method Details

#compress(css) ⇒ Object

Compresses the given CSS using Sass::Engine's :compressed output style.


17
18
19
20
21
22
23
24
25
26
27
# File 'lib/sprockets/sass/v2/compressor.rb', line 17

def compress(css)
  if css.count("\n") >= 2
    ::Sass::Engine.new(css,
                       syntax: :scss,
                       cache: false,
                       read_cache: false,
                       style: :compressed).render
  else
    css
  end
end