Class: Sinatra::AssetPipeline::Task

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/sinatra/asset_pipeline/task.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_klass) ⇒ Task

Returns a new instance of Task.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sinatra/asset_pipeline/task.rb', line 8

def initialize(app_klass)
  namespace :assets do
    desc "Precompile assets"
    task :precompile do
      environment = app_klass.sprockets
      manifest = Sprockets::Manifest.new(environment.index, app_klass.assets_public_path)
      manifest.compile(app_klass.assets_precompile)
    end

    desc "Clean assets"
    task :clean do
      FileUtils.rm_rf(app_klass.assets_public_path)
    end
  end
end

Class Method Details

.define!(app_klass) ⇒ Object



24
25
26
# File 'lib/sinatra/asset_pipeline/task.rb', line 24

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