Class: Sinatra::AssetPack::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra/assetpack/engine.rb

Overview

The base class for all CSS/JS compression engines.

Instance Method Summary collapse

Instance Method Details

#sys(type, str, cmd) ⇒ Object

Helper for system files. Usage: sys(‘css’, string, “sqwish %f”) Returns stdout.



8
9
10
11
12
13
14
15
16
17
# File 'lib/sinatra/assetpack/engine.rb', line 8

def sys(type, str, cmd)
  t = Tempfile.new ['', ".#{type}"]
  t.write(str)
  t.close

  output = `#{cmd.gsub('%f', t.path)}`
  FileUtils.rm t

  [output, t.path]
end