Module: HtmlNamespacing::Plugin::Sass

Defined in:
lib/html_namespacing/plugin/sass.rb

Defined Under Namespace

Modules: Sass_2_2

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.optionsObject (readonly)

Returns the value of attribute options.



14
15
16
# File 'lib/html_namespacing/plugin/sass.rb', line 14

def options
  @options
end

Class Method Details

.install(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/html_namespacing/plugin/sass.rb', line 5

def install(options = {})
  options[:prefix] ||= 'views'
  options[:callback] ||= lambda { |p| HtmlNamespacing::Plugin.default_relative_path_to_namespace(p) }
  options[:compress] ||= false
  @options = options
  Sass_2_2.install(options)
  HtmlNamespacing.options[:styles_for] = method(:styles_for)
end

.sass_optionsObject



16
17
18
# File 'lib/html_namespacing/plugin/sass.rb', line 16

def sass_options
  ::Sass::Plugin.options
end

.styles_for(relative_path, absolute_path) ⇒ Object



20
21
22
23
24
# File 'lib/html_namespacing/plugin/sass.rb', line 20

def styles_for(relative_path, absolute_path)
  # Assume the file exists. (If it was found by GlobFu, it should.)
  css_path = File.join(sass_options[:css_location], self.options[:prefix], relative_path.sub(/\.[^\.\/]*\z/, '.css'))
  File.read(css_path)
end