Module: Roda::RodaPlugins::Assets

Defined in:
lib/roda/plugins/assets.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods, RequestClassMethods, RequestMethods

Class Method Summary collapse

Class Method Details

.configure(app, opts = {}, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/roda/plugins/assets.rb', line 12

def self.configure(app, opts={}, &block)
  if app.opts[:assets]
    app.opts[:assets].merge!(opts)
  else
    app.opts[:assets] = opts.dup
  end

  opts                   = app.opts[:assets]
  opts[:css]           ||= []
  opts[:js]            ||= []
  opts[:js_folder]     ||= 'js'
  opts[:css_folder]    ||= 'css'
  opts[:path]          ||= File.expand_path("assets", Dir.pwd)
  opts[:compiled_path] ||= opts[:path]
  opts[:compiled_name] ||= 'compiled.roda.assets'
  opts[:concat_name]   ||= 'concat.roda.assets'
  opts[:route]         ||= 'assets'
  opts[:css_engine]    ||= 'scss'
  opts[:js_engine]     ||= 'coffee'
  opts[:concat]        ||= false
  opts[:compiled]      ||= false
  opts[:headers]       ||= {}

  if opts.fetch(:cache, true)
    opts[:cache] = app.thread_safe_cache
  end
end

.load_dependencies(app, opts = {}) ⇒ Object



8
9
10
# File 'lib/roda/plugins/assets.rb', line 8

def self.load_dependencies(app, opts={})
  app.plugin :render
end