class Docks::Themes::Assets
Attributes
root[R]
source_root[R]
Public Class Methods
new(options)
click to toggle source
# File lib/docks_theme_base/assets.rb, line 9 def initialize(options) @root = Pathname.new(options.fetch(:root)) source = options.fetch(:source_root, false) @source_root = source && Pathname.new(source) end
Public Instance Methods
files_for(*asset_path)
click to toggle source
# File lib/docks_theme_base/assets.rb, line 31 def files_for(*asset_path) Dir[root + File.join(asset_path)] end
path_for(*asset_path)
click to toggle source
# File lib/docks_theme_base/assets.rb, line 16 def path_for(*asset_path) asset_path = File.join(*asset_path) path = root + asset_path source_path = source_root && source_root + asset_path if path.exist? path elsif source_path && source_path.exist? source_path else fail Docks::NoAssetError, "No asset matching '#{asset_path}' was found in the asset folders." end end
scripts()
click to toggle source
# File lib/docks_theme_base/assets.rb, line 35 def scripts files_for("scripts/*.js") end
styles()
click to toggle source
# File lib/docks_theme_base/assets.rb, line 39 def styles files_for("styles/*.css") end