Sha256: a3d79aad46f32c37dc737a67bafb51efc3803fc2fd886e593b00647f036c2cae

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'lotus/assets/compressors/stylesheet'
require 'sass'

module Lotus
  module Assets
    module Compressors
      # Sass compressor for stylesheet
      #
      # It depends on <tt>sass</tt> gem.
      #
      # @since 0.1.0
      # @api private
      #
      # @see http://sass-lang.com
      # @see https://rubygems.org/gems/sass
      class SassStylesheet < Stylesheet
        # @since 0.1.0
        # @api private
        #
        # FIXME This is the same logic that we have for Lotus::Assets::Compiler
        SASS_CACHE_LOCATION = Pathname(Lotus.respond_to?(:root) ?
                                       Lotus.root : Dir.pwd).join('tmp', 'sass-cache')
        # @since 0.1.0
        # @api private
        def initialize
          @compressor = Sass::Engine
        end

        # @since 0.1.0
        # @api private
        def compress(filename)
          compressor.new(read(filename), filename: filename, syntax: :scss,
            style: :compressed, cache_location: SASS_CACHE_LOCATION).render
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lotus-assets-0.1.0 lib/lotus/assets/compressors/sass_stylesheet.rb