Module: Sinatra::Twitter::Bootstrap::AssetsHelper

Defined in:
lib/sinatra/twitter-bootstrap.rb

Instance Method Summary collapse

Instance Method Details

#bootstrap(attrb = '') ⇒ Object



92
93
94
# File 'lib/sinatra/twitter-bootstrap.rb', line 92

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

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



57
58
59
60
61
62
63
64
65
66
# File 'lib/sinatra/twitter-bootstrap.rb', line 57

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



88
89
90
# File 'lib/sinatra/twitter-bootstrap.rb', line 88

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

#bootstrap_js_default(attrb = '') ⇒ Object



78
79
80
81
82
83
84
85
86
# File 'lib/sinatra/twitter-bootstrap.rb', line 78

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



68
69
70
71
72
73
74
75
76
# File 'lib/sinatra/twitter-bootstrap.rb', line 68

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