Module: Sinatra::Compass::ClassMethods

Defined in:
lib/sinatra/compass.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#compass_prefixObject (readonly)

Returns the value of attribute compass_prefix.



10
11
12
# File 'lib/sinatra/compass.rb', line 10

def compass_prefix
  @compass_prefix
end

#compass_routeObject (readonly)

Returns the value of attribute compass_route.



10
11
12
# File 'lib/sinatra/compass.rb', line 10

def compass_route
  @compass_route
end

Instance Method Details

#get_compass(path, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sinatra/compass.rb', line 11

def get_compass(path, &block)
  path.sub! /^\//, ''
  block ||= Proc.new do |file|
    content_type 'text/css', :charset => 'utf-8'
    compass :"#{path}/#{params[:name]}"
  end
  set :compass, :sass_dir => views / path unless compass[:sass_dir] && compass[:sass_dir].directory?
  @compass_prefix = "/#{path}"
  @compass_route.deactivate if @compass_route
  @compass_route = get("/#{path}" / ":name.css", &block)
end