Module: ViewAssets

Defined in:
lib/view_assets.rb,
lib/view_assets/error.rb,
lib/view_assets/version.rb,
lib/view_assets/js_assets.rb,
lib/view_assets/css_assets.rb,
lib/view_assets/directives.rb,
lib/view_assets/assets_finder.rb

Overview

Manifest file is a file that contains some dependency directives on top of it. Finder will parse these directives if existed and include them in the html. Usually, the first manifest file will be application. in /app/assets/ folder. However, if there is a :controller. file existed in /app/assets/:controller folder, then it will replace application as the first manifest file. It will append assets dependency before every action assets. If both application and :controller manifest file are not existed, then the manifest file list will be empty at first.

Defined Under Namespace

Classes: AssetsFinder, ConfigurationError, Directive, FileNotFound, JavascriptAssets, StyleSheetAssets, UnknownDirectiveError

Constant Summary collapse

TO_VERIFY =

To verify all assets and throw exception when find out inexistent asset Defaults to turn off. DO NOT use it in production. todo find out how to document constant

false
VERSION =
"0.0.3"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#css_assetsObject

Returns the value of attribute css_assets.



22
23
24
# File 'lib/view_assets.rb', line 22

def css_assets
  @css_assets
end

#js_assetsObject

Returns the value of attribute js_assets.



22
23
24
# File 'lib/view_assets.rb', line 22

def js_assets
  @js_assets
end

Instance Method Details

#include_assets_with_assets_mvc(controller, action) ⇒ Object

TODO need a new controller-action configuring interface, try to configure them in helper instead of view files



25
26
27
28
29
30
# File 'lib/view_assets.rb', line 25

def include_assets_with_assets_mvc(controller, action)
  @va_controller = controller
  @va_action = action
  
  raw [css_assets.all, js_assets.all].flatten.uniq.join("\n ")
end