Sha256: 6bce30e3146b9c2cf694922138d5779784d0c3cab4f4a0f92d953deeb627b0f0

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

#
# File::       SASSProcessor.rb
# Author::     wkm
# Copyright::  2009
# License::    GPL
#
# processes .sass stylesheets to generate the associated CSS
#

module SiteFuel
  module Processor
    require 'sitefuel/extensions/Silently'

    # since the haml gem gives exec() warnings, we temporarily lower the verbosity
    # (last tested with 2.2.14, this might not be needed with a future version)
    silently { require 'sass' }

    require 'sitefuel/processors/AbstractStringBasedProcessor'
    require 'sitefuel/processors/CSSProcessor'

    class SASSProcessor < AbstractStringBasedProcessor

      def self.file_patterns
        ['.sass']
      end
      
      def self.default_filterset
        :generate
      end

      def self.filterset_generate
        [:generate, :minify]
      end

      # generates the raw .css file from a .sass file
      #
      # TODO it's very important that generate be the first filter run
      def filter_generate
        engine = Sass::Engine.new(document)
        @document = engine.render
      end

      # runs the CSSProcessor's minify filter
      def filter_minify
        @document = CSSProcessor.filter_string(:minify, document)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sitefuel-0.0.0b lib/sitefuel/processors/SASSProcessor.rb
sitefuel-0.0.0a lib/sitefuel/processors/SASSProcessor.rb