Sha256: 38b7d290073830524b3edbe6d55a7f67122fc5683dbc34e05bc921b604f57891

Contents?: true

Size: 989 Bytes

Versions: 6

Compression:

Stored size: 989 Bytes

Contents

module SemiStatic
    class Stylesheet < Base
        attr_reader :name, :options, :output_dir, :output_path
        
        def initialize(site, name, options={})
            path = "#{name}.sass"
            path = "#{name}.css" unless File.file?(path)
            super(site, path)
            
            @name, @options = name, options
            @output_dir = 'css'
            @output_path = "#{output_dir}/#{name}.css"
        end
        
        def load
            super
            Dir.chdir(File.dirname(full_source_path)) do
                @content = case source_ext
                when '.sass'
                    Sass::Engine.new(source_content, :filename => source_path).render
                when '.css'
                    source_content
                else
                    raise ArgumentError, "Unsupported format: #{self.source_path}"
                end
            end
        end
        
        def render
            @content
        end
    end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
zzot-semi-static-0.0.2 lib/semi-static/stylesheet.rb
zzot-semi-static-0.0.3 lib/semi-static/stylesheet.rb
zzot-semi-static-0.0.4 lib/semi-static/stylesheet.rb
zzot-semi-static-0.0.5 lib/semi-static/stylesheet.rb
zzot-semi-static-0.0.6 lib/semi-static/stylesheet.rb
zzot-zzot-semi-static-0.0.1 lib/semi-static/stylesheet.rb