Module: SlimGruntHelpers::Helpers

Defined in:
lib/slim-grunt-helpers/helpers.rb

Instance Method Summary collapse

Instance Method Details

#sg_empty_hrefObject



49
50
51
# File 'lib/slim-grunt-helpers/helpers.rb', line 49

def sg_empty_href
  'javascript:void(0);'
end

#sg_enclose_newlineObject



9
10
11
# File 'lib/slim-grunt-helpers/helpers.rb', line 9

def sg_enclose_newline
  %Q{\n#{ yield }\n}
end

#sg_usemin_css(path, options = {}) {|usemin| ... } ⇒ Object

Options:

  • ‘alt` which allows to set alternate paths which usemin should look into

  • ‘absolute` which ensures all files are prepended with ’/‘ when true

Yields:

  • (usemin)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/slim-grunt-helpers/helpers.rb', line 16

def sg_usemin_css(path, options={})
  usemin  = SlimGruntHelpers::Models::UseminCss.new
  options = { alt: nil, absolute: false }.merge!(options)

  alt = ''
  alt = "(#{ options[:alt] })" unless options[:alt].nil?

  text  = "\n<!-- build:css#{ alt } #{ path } -->\n"
  yield(usemin)
  usemin.each(options) do |link|
    text << "#{ link }\n"
  end
  text << "<!-- endbuild -->\n"
end

#sg_usemin_js(path, options = {}) {|usemin| ... } ⇒ Object

Options:

  • ‘alt` which allows to set alternate paths which usemin should look into

  • ‘absolute` which ensures all files are prepended with ’/‘ when true

Yields:

  • (usemin)


34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/slim-grunt-helpers/helpers.rb', line 34

def sg_usemin_js(path, options={})
  usemin  = SlimGruntHelpers::Models::UseminJs.new
  options = { alt: nil, absolute: false }.merge!(options)

  alt = ''
  alt = "(#{ options[:alt] })" unless options[:alt].nil?

  text  = "\n<!-- build:js#{ alt } #{ path } -->\n"
  yield(usemin)
  usemin.each(options) do |link|
    text << "#{ link }\n"
  end
  text << "<!-- endbuild -->\n"
end