Module: Sinatra::Bootstrap::AssetsHelpers

Defined in:
lib/sinatra/bootstrap.rb

Instance Method Summary collapse

Instance Method Details

#bootstrap(attrb = '') ⇒ Object



95
96
97
# File 'lib/sinatra/bootstrap.rb', line 95

def bootstrap(attrb = '')
  "#{bootstrap_css(attrb)} \n#{bootstrap_js_legacy(attrb)} \n#{bootstrap_js_default(attrb)}"
end

#bootstrap_css(meta = true, attrb = '') ⇒ Object



60
61
62
63
64
65
66
67
68
69
# File 'lib/sinatra/bootstrap.rb', line 60

def bootstrap_css(meta = true, attrb = '')
  output = ''
  output += "<meta name='viewport' content='width=device-width, initial-scale=1.0'>\n" if meta

  Assets::ASSETS[:css].each do |file, _|
    output += Assets::css_tag url('/css/%s' % file), attrb 
  end

  output.chomp
end

#bootstrap_js(attrb = '') ⇒ Object



91
92
93
# File 'lib/sinatra/bootstrap.rb', line 91

def bootstrap_js(attrb = '')
  "#{bootstrap_js_legacy(attrb)} \n#{bootstrap_js_default(attrb)}"
end

#bootstrap_js_default(attrb = '') ⇒ Object



81
82
83
84
85
86
87
88
89
# File 'lib/sinatra/bootstrap.rb', line 81

def bootstrap_js_default(attrb = '')
  output = ''

  Assets::ASSETS[:default_js].each do |file, _|
    output += Assets::js_tag url('/js/%s' % file), attrb
  end

  output.chomp
end

#bootstrap_js_legacy(attrb = '') ⇒ Object



71
72
73
74
75
76
77
78
79
# File 'lib/sinatra/bootstrap.rb', line 71

def bootstrap_js_legacy(attrb = '')
  output = ''

  Assets::ASSETS[:legacy_js].each do |file, _|
    output += Assets::js_tag url('/js/%s' % file), attrb
  end

  "<!--[if lt IE 9]> \n#{output.chomp} \n<![endif]-->"
end