Module: Sinatra::Compass

Defined in:
lib/sinatra/compass.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.registered(klass) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/sinatra/compass.rb', line 35

def self.registered(klass)
  klass.register Sugar
  klass.register AdvancedRoutes
  klass.extend ClassMethods
  klass.send :include, InstanceMethods
  klass.set :compass,
  :project_path => klass.root_path, :output_style => (klass.development? ? :expanded : :compressed),
  :sass_dir => klass.views / "stylesheets", :line_comments => klass.development?
  set_app_file(klass) if klass.app_file?
end

.set_app_file(klass) ⇒ Object



46
47
48
49
# File 'lib/sinatra/compass.rb', line 46

def self.set_app_file(klass)
  klass.set :compass, :root_path => klass.root_path
  klass.get_compass("stylesheets") if (klass.views / "stylesheets").directory?
end

.set_compass(klass) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/sinatra/compass.rb', line 51

def self.set_compass(klass)
  ::Compass.configuration do |config|
    config.sass_options ||= {}
    klass.compass.each do |option, value|
      if config.respond_to? option
        config.send "#{option}=", value
      else
        config.sass_options.merge! option.to_sym => value
      end
    end
  end
end