File: merb-haml.rb

package info (click to toggle)
ruby-merb-haml 1.1.3-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 260 kB
  • ctags: 28
  • sloc: ruby: 152; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 1,197 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require "merb-core"

require "haml"
require "merb-haml/template"
Merb::Plugins.add_rakefiles(File.join(File.dirname(__FILE__) / "merb-haml" / "merbtasks"))

Merb::Plugins.config[:sass] ||= {}

Merb::BootLoader.after_app_loads do

  template_locations = []
  template_locations << Merb.dir_for(:stylesheet) / "sass"

  # extract template locations list from sass config
  config_location = Merb::Plugins.config[:sass][:template_location]
  if config_location.is_a? Hash
    template_locations += config_location.keys
  elsif config_location
    template_locations << config_location.to_s
  end

  # setup sass if any template paths match
  if template_locations.any?{|location| File.directory?(location) }
    require "sass"
    if Merb::Config[:sass]
      Merb.logger.info("Please define your sass settings in Merb::Plugins.config[:sass] not Merb::Config")
      Sass::Plugin.options = Merb::Config[:sass]
    else
      Sass::Plugin.options = Merb::Plugins.config[:sass]
    end
  end

end

generators = File.join(File.dirname(__FILE__), 'generators')
Merb.add_generators generators / "resource_controller"
Merb.add_generators generators / "controller"
Merb.add_generators generators / "layout"