module AssetHelper

Public Instance Methods

file_exists?(relative_path) click to toggle source
# File lib/generator/helper/asset_helper.rb, line 7
def file_exists?(relative_path)
  File.exists?("#{@output_folder}/#{relative_path}")
end
glyph_icon(icon, content='') click to toggle source
# File lib/generator/helper/asset_helper.rb, line 29
def glyph_icon(icon, content='')
  content_tag(:span, content, class: glyph_icon_classes(icon))
end
glyph_icon_classes(icon) click to toggle source
# File lib/generator/helper/asset_helper.rb, line 25
def glyph_icon_classes(icon)
  "glyphicon glyphicon-#{icon}"
end
headjs_javascript_include_bower_tag(tag, path) click to toggle source
# File lib/generator/helper/asset_helper.rb, line 56
def headjs_javascript_include_bower_tag(tag, path)
  headjs_javascript_include_tag(tag, path_to_bower(path))
end
headjs_javascript_include_tag(tag, path) click to toggle source
# File lib/generator/helper/asset_helper.rb, line 50
def headjs_javascript_include_tag(tag, path)
  content_tag :script do
    raw "head.load({'#{tag}': '#{path_to_js(path)}'});"
  end
end
javascript_include_bower_tag(path) click to toggle source
# File lib/generator/helper/asset_helper.rb, line 41
def javascript_include_bower_tag(path)
  '<script src="'+path_to_bower(path)+'"></script>'
end
path_to_bower(path) click to toggle source
# File lib/generator/helper/asset_helper.rb, line 45
def path_to_bower(path)
  return "bower_components/#{path}"
  path
end
select_partials(dir='*', &block) click to toggle source
# File lib/generator/helper/asset_helper.rb, line 33
def select_partials(dir='*', &block)
  folder = "#{@input_folder}/partials/#{dir}"
  Dir.glob("#{folder}").each do |partial|
    partial = partial.sub("#{@input_folder}/partials/", '').sub('.haml', '')
    block.call(partial) if block_given?
  end
end
with_coffee(&block) click to toggle source
# File lib/generator/helper/asset_helper.rb, line 11
def with_coffee(&block)
  input = capture_haml(&block)
  content_tag :script do
    raw Uglifier.compile(Generator::CoffeeGenerator.new.compile(input))
  end
end
with_sass(&block) click to toggle source
# File lib/generator/helper/asset_helper.rb, line 18
def with_sass(&block)
  input = capture_haml(&block)
  content_tag :style do
    raw Generator::SassGenerator.new.compile(input)
  end
end