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