Class: Sinatra::AssetPack::SqwishEngine

Inherits:
Engine
  • Object
show all
Defined in:
lib/sinatra/assetpack/engines/sqwish.rb

Instance Method Summary collapse

Methods inherited from Engine

#sys

Instance Method Details

#css(str, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/sinatra/assetpack/engines/sqwish.rb', line 3

def css(str, options={})
  cmd = "#{sqwish_bin} %f "
  cmd += "--strict"  if options[:strict]

  _, input = sys :css, str, cmd
  output   = input.gsub(/\.css/, '.min.css')

  File.read(output)
rescue => e
  nil
end

#sqwish_binObject



15
16
17
# File 'lib/sinatra/assetpack/engines/sqwish.rb', line 15

def sqwish_bin
  ENV['SQWISH_PATH'] || "sqwish"
end