Module: Xmvc::Helpers::Sprockets::ClassMethods

Defined in:
lib/xmvc/helpers/sprockets.rb

Instance Method Summary collapse

Instance Method Details

#xmvc_asset(vid, format) ⇒ Object

Request a Sprockets::Concatenation file

Parameters:

  • vid (Symbol)

    Vendor-id

  • format (Symbol)

    :js, :css, :sass, etc



52
53
54
55
56
57
58
59
# File 'lib/xmvc/helpers/sprockets.rb', line 52

def xmvc_asset(vid, format)
  sec = secretary(vid.to_sym, format)
  filename = File.join(@xmvc_root, @xmvc_asset_root, "javascripts", vid.to_s, "#{vid}-all.#{format.to_s}")
  unless source_is_unchanged?(sec)
    sec.concatenation.save_to(filename)
  end
  filename
end

#xmvc_asset_root(asset_root) ⇒ Object

Defines teh Sprockets asset_root param where concatenation files will be created.



43
44
45
# File 'lib/xmvc/helpers/sprockets.rb', line 43

def xmvc_asset_root(asset_root)
  @xmvc_asset_root = asset_root
end

#xmvc_root(root) ⇒ Object

Defines the Sprockets root param xmvc_root File.join(MyApp::ROOT, “subfolder”)



36
37
38
# File 'lib/xmvc/helpers/sprockets.rb', line 36

def xmvc_root(root)
  @xmvc_root = root
end

#xmvc_vendors(vendors) ⇒ Object

Define the available vendors with Thor task API xmvc_vendors :extjs => ExtJS::API, :“extjs-mvc” => ExtJS::MVC::API



25
26
27
28
29
30
# File 'lib/xmvc/helpers/sprockets.rb', line 25

def xmvc_vendors(vendors)
  @vendors = vendors

  # Add the Xmvc API
  @vendors[:app] = Xmvc::API
end