Module: Racket::Helpers::Sass

Defined in:
lib/racket/helpers/sass.rb

Overview

Helper module that allows CSS files to be loaded dynamically using SASS.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ nil

Whenever this helper is included in a controller it will setup a link between a SASS directory and a CSS directory.

Parameters:

  • klass (Class)

Returns:

  • (nil)


56
57
58
59
60
61
# File 'lib/racket/helpers/sass.rb', line 56

def self.included(klass)
  route = klass.get_route.slice(1..-1) # Remove leading slash
  sass_dir = add_template_location(klass, route)
  add_warmup_urls(klass, sass_dir, route)
  nil
end

Instance Method Details

#css(sym) ⇒ String

Get route to CSS, which will use SASS in the background to deliver the CSS.

Parameters:

  • sym (Symbol)

Returns:

  • (String)


28
29
30
31
32
# File 'lib/racket/helpers/sass.rb', line 28

def css(sym)
  route = self.class.get_route
  route = '' if route == '/' # Special case for root controller
  "/css#{route}/#{sym}.css"
end