Module: Middleman::CoreExtensions::Rendering

Defined in:
lib/middleman-core/core_extensions/rendering.rb

Defined Under Namespace

Modules: InstanceMethods Classes: TemplateNotFound

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object Also known as: included

Once registered



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/middleman-core/core_extensions/rendering.rb', line 18

def registered(app)
  # Include methods
  app.send :include, InstanceMethods

  app.define_hook :before_render
  app.define_hook :after_render

  ::Tilt.mappings.delete('html') # WTF, Tilt?
  ::Tilt.mappings.delete('csv')

  require 'active_support/core_ext/string/output_safety'

  # Activate custom renderers
  require "middleman-core/renderers/erb"
  app.register Middleman::Renderers::ERb

  # CoffeeScript Support
  begin
    require "middleman-core/renderers/coffee_script"
    app.register Middleman::Renderers::CoffeeScript
  rescue LoadError
  end

  # Haml Support
  begin
    require "middleman-core/renderers/haml"
    app.register Middleman::Renderers::Haml
  rescue LoadError
  end

  # Sass Support
  begin
    require "middleman-core/renderers/sass"
    app.register Middleman::Renderers::Sass
  rescue LoadError
  end

  # Markdown Support
  require "middleman-core/renderers/markdown"
  app.register Middleman::Renderers::Markdown

  # AsciiDoc Support
  begin
    require "middleman-core/renderers/asciidoc"
    app.register Middleman::Renderers::AsciiDoc
  rescue LoadError
  end

  # Liquid Support
  begin
    require "middleman-core/renderers/liquid"
    app.register Middleman::Renderers::Liquid
  rescue LoadError
  end

  # Slim Support
  begin
    require "middleman-core/renderers/slim"
    app.register Middleman::Renderers::Slim
  rescue LoadError
  end

  # Less Support
  begin
    require "middleman-core/renderers/less"
    app.register Middleman::Renderers::Less
  rescue LoadError
  end

  # Stylus Support
  begin
    require "middleman-core/renderers/stylus"
    app.register Middleman::Renderers::Stylus
  rescue LoadError
  end

  # Clean up missing Tilt exts
  app.after_configuration do
    Tilt.mappings.each do |key, klasses|
      begin
        Tilt[".#{key}"]
      rescue LoadError, NameError
        Tilt.mappings.delete(key)
      end
    end
  end
end