Sha256: b20f132216211e69f35b8729468953146070d270e4226792cf4d549e4af35510

Contents?: true

Size: 759 Bytes

Versions: 2

Compression:

Stored size: 759 Bytes

Contents

# frozen_string_literal: true
module Sprockets
  module Sass
    module V2
      # Class used to compress CSS files
      class Compressor
        def self.instance
          @instance ||= new
        end

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

        # Compresses the given CSS using Sass::Engine's
        # :compressed output style.
        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
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sprockets-sass-2.0.0.beta2 lib/sprockets/sass/v2/compressor.rb
sprockets-sass-2.0.0.beta1 lib/sprockets/sass/v2/compressor.rb