Sha256: e2d58bb17b5ad6f11c213a54f5ed353fd1b37982e349cec2a551f72d16ac597e

Contents?: true

Size: 1.12 KB

Versions: 19

Compression:

Stored size: 1.12 KB

Contents

module Hanami
  module Assets
    module Compilers
      # Sass/SCSS Compiler
      #
      # @since 0.3.0
      # @api private
      class Sass < Compiler
        # @since 0.3.0
        # @api private
        EXTENSIONS = /\.(sass|scss)\z/

        # @since 0.1.0
        # @api private
        CACHE_LOCATION = Pathname(Hanami.respond_to?(:root) ? # rubocop:disable Style/MultilineTernaryOperator
                                  Hanami.root : Dir.pwd).join('tmp', 'sass-cache')

        # @since 0.3.0
        # @api private
        def self.eligible?(name)
          name.to_s =~ EXTENSIONS
        end

        private

        # @since 0.3.0
        # @api private
        def renderer
          Tilt.new(source, nil, load_paths: load_paths, cache_location: CACHE_LOCATION)
        end

        # @since 0.3.0
        # @api private
        def dependencies
          engine.dependencies.map { |d| d.options[:filename] }
        end

        # @since 0.3.0
        # @api private
        def engine
          ::Sass::Engine.for_file(source.to_s, load_paths: load_paths, cache_location: CACHE_LOCATION)
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
hanami-assets-1.3.0 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.3.0.beta1 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.2.0 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.2.0.rc2 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.2.0.rc1 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.2.0.beta2 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.2.0.beta1 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.1.1 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.1.0 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.1.0.rc1 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.1.0.beta3 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.1.0.beta2 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.1.0.beta1 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.0.0 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.0.0.rc1 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.0.0.beta2 lib/hanami/assets/compilers/sass.rb
hanami-assets-1.0.0.beta1 lib/hanami/assets/compilers/sass.rb
hanami-assets-0.4.0 lib/hanami/assets/compilers/sass.rb
hanami-assets-0.3.0 lib/hanami/assets/compilers/sass.rb