# encoding: utf-8 # this module exposes additional features for haml files module AssetHelper def meta_tag(type, content) '' end def meta_tag_http(type, content) '' end def link_tag(source, relation, type = '') type = " type='#{type}'" if type '' end def external_path?(path) path.start_with?('//') || path.start_with?('http') end def file_exists?(path) File.exist? File.join(EasyHtmlGenerator::DIST_PATH, path) end def with_coffee(&block) input = capture_haml(&block) content_tag :script do raw @project.generators.compile_coffee.do_input! input end end def with_sass(&block) input = capture_haml(&block) content_tag :style do raw @project.generators.compile_sass.do_input! input end end def glyph_icon_classes(icon) "glyphicon glyphicon-#{icon}" end def glyph_icon(icon, content = '') content_tag(:span, content, class: glyph_icon_classes(icon)) end def headjs_javascript_include_tag(tag, path) content_tag :script do raw "head.load({'#{tag}': '#{path_to_javascript(path)}'});" end end def headjs_stylesheet_link_tag(tag, path) headjs_javascript_include_tag(tag, path_to_stylesheet(path)) end def inline_stylesheet_link_tag(path) return path if external_path?(path) styles_path = @project.dist_path_to(:styles, path) if File.exist? styles_path path = styles_path else path = File.join(@project.dist_path, path) end content_tag :style do raw @project.generators.minimize_css.do_input! File.read(path) end end def inline_javascript_include_tag(path) return path if external_path?(path) scripts_path = @project.dist_path_to(:scripts, path) if File.exist? scripts_path path = scripts_path else path = File.join(@project.dist_path, path) end content_tag :script do raw @project.generators.minimize_js.do_input! File.read(path) end end end