Sha256: b34e19f1457e32bb41c07e1e6366535b23c2c369b5abb430b1157f1124707398

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'awestruct/handlers/base_tilt_handler'
require 'awestruct/handlers/file_handler'
require 'awestruct/handlers/front_matter_handler'
require 'awestruct/handlers/layout_handler'

require 'compass'
require 'bootstrap-sass'

module Awestruct
  module Handlers
    class CssTiltHandler < BaseTiltHandler

      CHAIN = Awestruct::HandlerChain.new(/\.(sass|scss|less)$/,
        Awestruct::Handlers::FileHandler,
        Awestruct::Handlers::CssTiltHandler
      )

      def initialize(site, delegate)
        super( site, delegate )
      end

      ##
      # Sass Engine requires dynamically generated options.
      ##
      def options
        opts = super

        # Sass / Scss
        opts[:load_paths] ||= []
        Compass::Frameworks::ALL.each do |framework|
          opts[:load_paths] << framework.stylesheets_directory
        end
        opts[:load_paths] << File.join(site.config.dir.to_s, File.dirname(relative_source_path) ) unless relative_source_path.nil?

        # Less use Paths instead of load_paths
        opts[:paths] = opts[:load_paths]

        return opts
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
awestruct-0.5.0 lib/awestruct/handlers/css_tilt_handler.rb
awestruct-0.5.0.cr lib/awestruct/handlers/css_tilt_handler.rb