class Sinatra::AssetPack::Engine

The base class for all CSS/JS compression engines.

Public Instance Methods

sys(type, str, cmd) click to toggle source

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

# 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