Class: Faml::FilterCompilers::TiltBase

Inherits:
Base
  • Object
show all
Includes:
Temple::Utils
Defined in:
lib/faml/filter_compilers/tilt_base.rb

Direct Known Subclasses

Coffee, Markdown, Sass, Scss

Class Method Summary collapse

Methods inherited from Base

#need_newline?

Class Method Details

.render_with_tilt(name, source, indent_width: 0) ⇒ Object



11
12
13
14
15
# File 'lib/faml/filter_compilers/tilt_base.rb', line 11

def self.render_with_tilt(name, source, indent_width: 0)
  text = ::Tilt["t.#{name}"].new { source }.render
  indent = ' ' * indent_width
  "#{indent}#{text.rstrip.gsub("\n", "\n#{indent}")}"
end