Module: Hoverboard::Assets
- Included in:
- Hoverboard
- Defined in:
- lib/hoverboard/assets.rb,
lib/hoverboard/assets/image.rb,
lib/hoverboard/assets/context.rb
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
- #css ⇒ Object
- #css_file ⇒ Object
- #css_template_file ⇒ Object
- #dev_root ⇒ Object
- #inline_css ⇒ Object
- #inline_javascript ⇒ Object
- #javascript ⇒ Object
- #javascript_file ⇒ Object
- #javascript_template_file ⇒ Object
- #mustache ⇒ Object
- #template_ctx ⇒ Object
Class Method Details
.rebuild! ⇒ Object
5 6 7 8 9 10 |
# File 'lib/hoverboard/assets.rb', line 5 def rebuild! Hoverboard.assets_path.mkpath Hoverboard.javascript_file.open('w') {|f| f << Hoverboard.javascript} Hoverboard.css_file.open('w') {|f| f << Hoverboard.css } end |
Instance Method Details
#css ⇒ Object
31 32 33 |
# File 'lib/hoverboard/assets.rb', line 31 def css mustache.render(css_template_file.read, Context.new) end |
#css_file ⇒ Object
51 52 53 |
# File 'lib/hoverboard/assets.rb', line 51 def css_file @css_file ||= assets_path+'hoverboard.css' end |
#css_template_file ⇒ Object
43 44 45 |
# File 'lib/hoverboard/assets.rb', line 43 def css_template_file @css_template_file ||= dev_root+'stylesheets/hoverboard.css.mustache' end |
#dev_root ⇒ Object
35 36 37 |
# File 'lib/hoverboard/assets.rb', line 35 def dev_root @dev_root ||= gem_root+'dev' end |
#inline_css ⇒ Object
59 60 61 |
# File 'lib/hoverboard/assets.rb', line 59 def inline_css css_file.exist? ? css_file.read : '' end |
#inline_javascript ⇒ Object
55 56 57 |
# File 'lib/hoverboard/assets.rb', line 55 def inline_javascript javascript_file.exist? ? javascript_file.read : '' end |
#javascript ⇒ Object
27 28 29 |
# File 'lib/hoverboard/assets.rb', line 27 def javascript mustache.render(javascript_template_file.read, Context.new) end |
#javascript_file ⇒ Object
47 48 49 |
# File 'lib/hoverboard/assets.rb', line 47 def javascript_file @javascript_file ||= assets_path+'hoverboard.js' end |
#javascript_template_file ⇒ Object
39 40 41 |
# File 'lib/hoverboard/assets.rb', line 39 def javascript_template_file @javascript_template_file ||= dev_root+'javascripts/hoverboard.js.mustache' end |
#mustache ⇒ Object
20 21 22 23 24 25 |
# File 'lib/hoverboard/assets.rb', line 20 def mustache @mustache ||= begin require 'mustache' Mustache end end |
#template_ctx ⇒ Object
16 17 18 |
# File 'lib/hoverboard/assets.rb', line 16 def template_ctx Context.new end |