Class: Roda::RodaPlugins::SprocketAssets::Task

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/roda/plugins/sprocket_assets_task.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_klass) ⇒ Task

Returns a new instance of Task.


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/roda/plugins/sprocket_assets_task.rb', line 9

def initialize(app_klass)
  namespace :assets do
    desc "Precompile assets"
    task :precompile do
      opts = app_klass.sprocket_assets_opts
      environment = opts[:sprockets]
      manifest = Sprockets::Manifest.new(environment.index, opts[:public_path])
      manifest.compile(opts[:precompile])
    end

    desc "Clean assets"
    task :clean do
      FileUtils.rm_rf(app_klass.sprocket_assets_opts[:public_path])
    end
  end
end

Class Method Details

.define!(app_klass) ⇒ Object


26
27
28
# File 'lib/roda/plugins/sprocket_assets_task.rb', line 26

def self.define!(app_klass)
  self.new app_klass
end