Sha256: 94a5f181a800accd868692c8e3a09a030b9424a98e8369887150c179fb7b36cd

Contents?: true

Size: 1023 Bytes

Versions: 20

Compression:

Stored size: 1023 Bytes

Contents

require 'awestruct/handlers/base_handler'

require 'compass'
require 'ninesixty'
require 'bootstrap-sass'

module Awestruct
  module Handlers
    class BaseSassHandler < BaseHandler

      attr_reader :syntax

      def initialize(site, delegate, syntax)
        super( site, delegate )
        @syntax = syntax
      end

      def simple_name
        File.basename( relative_source_path, ".#{syntax}" )
      end

      def output_filename
        simple_name + '.css'
      end

      def rendered_content(context, with_layouts=true)
        sass_opts = Compass.sass_engine_options
        sass_opts[:load_paths] ||= []
        Compass::Frameworks::ALL.each do |framework|
          sass_opts[:load_paths] << framework.stylesheets_directory
        end
        sass_opts[:load_paths] << File.dirname( context.page.source_path )
        sass_opts[:syntax] = syntax
        sass_opts[:custom] = site
        sass_engine = Sass::Engine.new( raw_content, sass_opts )
        sass_engine.render
      end

    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
awestruct-0.4.8 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.7 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.6 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.5 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.4 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.3 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.2 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.2.x10 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.2.x9 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.2.x8 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.2.x7 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.2.x6 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.2.x5 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.2.x4 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.2.x3 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.2.x2 lib/awestruct/handlers/base_sass_handler.rb
awestruct-0.4.2.x1 lib/awestruct/handlers/base_sass_handler.rb
awestructx-0.4.1.x1 lib/awestruct/handlers/base_sass_handler.rb
awestructx-0.4.1 lib/awestruct/handlers/base_sass_handler.rb
awestructx-0.4.0 lib/awestruct/handlers/base_sass_handler.rb