Sha256: 1136e4363956504b556ce3dce50e6b2f41b38d18bf0e32ab221f9ba7c750d006
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# encoding: utf-8 require 'haml' require 'easy_html_generator/generator/compile/base' # this generator compiles haml files from src folder and copies them # to the dist folder class EasyHtmlGenerator::Generator::Compile::Haml < EasyHtmlGenerator::Generator::Compile::Base require 'easy_html_generator/generator/compile/haml/context' require 'easy_html_generator/generator/compile/haml/layout' def do_input!(input, input_file, *_args) file_name = File.basename input_file scope = file_name.split('.').first context = Context.new(@project, @config, scope) layout = Layout.layout_from_file(@project.src_path_to(:views), input_file, @config) do_input(input, layout, context, scope) rescue StandardError => e raise e, "#{e.message} in #{input_file} ", e.backtrace end def do_input(input, layout, context, scope) result = layout.render(context, body_class: scope) do body = Haml::Engine.new(input, @config.renderer) body.render(context) end return result unless @config.minimize EasyHtmlGenerator::Generator::Minimize::Html.compress result end def file_changed?(file) # regenerate all haml files except imported once !File.basename(file).start_with? '_' end def input_to_output_file(input_file, config) super(input_file, config).gsub('.html.haml', '.html') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
easy_html_generator-1.0.6 | lib/easy_html_generator/generator/compile/haml.rb |