Sha256: cb87aa2ba245c02332c5a8284b303427596a0b21ab26a8cf55a31e5f363ec05c

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

gem "sinatra-compass"
require "sinatra/compass"

gem "compass-susy-plugin"
require "susy"

require "compass"
require "sinatra/base"
require "sinatra/sugar"
require "sinatra/advanced_routes"

module Caboodle
  class Susy < Caboodle::Kit
            
    get("/susy/:name.css") do
      content_type 'text/css', :charset => 'utf-8'
      sass_dir = File.expand_path(File.join(File.dirname(__FILE__),"views","susy"))
      load_paths = [Caboodle::App.root, File.join(Caboodle::App.root,"views"), File.join(Caboodle::App.root,"views","stylesheets"), sass_dir] + ::Compass.sass_engine_options[:load_paths]
      Caboodle::Kits.each do |name|
        kit_name = name.to_s.split("::").last || name
        kit_name = kit_name.downcase
        path = File.expand_path(File.join(File.dirname(__FILE__),"..",kit_name,"views"))
        load_paths << path
      end
      
      options = {:sass_dir => sass_dir, :syntax => :scss, :load_paths => load_paths}
      the_sass = open(File.join(File.dirname(__FILE__),"views","susy","screen.scss")).read
      imported_files = []
      Caboodle::SASS.each do |s|
        the_sass << "\n"
        add_file = "@import \"#{s}\";"
        imported_files << add_file
        the_sass << add_file
      end
      
      the_sass << "\n/* Generated from:"
      the_sass << load_paths.join("\n")
      the_sass << "\n"
      the_sass << imported_files.join("\n")
      the_sass << "*/"
      
      opts = options.merge!(::Compass.sass_engine_options)
      opts[:load_paths] = load_paths
      sass the_sass, opts
    end

    stylesheets ["/susy/screen.css"]

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caboodle-0.2.13 lib/caboodle/kits/susy/susy.rb