Sha256: 6ff1880c166ba07b44b957fc3e512963973d1bdca4902fa14d03547a358db2ac

Contents?: true

Size: 586 Bytes

Versions: 8

Compression:

Stored size: 586 Bytes

Contents

require 'execjs'

module Csso
  class JsLib

    def initialize
      if ExecJS.runtime.is_a?(ExecJS::ExternalRuntime)
        warn "You're using ExecJS::ExternalRuntime, did you forget to add therubyracer or other execjs runtime to gemfile?"
      end

      lib = File.read(File.expand_path('../../' + CSSO_JS_LIB, File.dirname(__FILE__)))
      unless @csso = ExecJS.runtime.compile(lib)
        raise 'cannot compile or what?'
      end
    end

    def compress css, structural_optimization=true
      @csso.call("do_compression", css, !structural_optimization)
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
csso-rails-0.4.1 lib/csso/js_lib.rb
csso-rails-0.4.0 lib/csso/js_lib.rb
csso-rails-0.3.4 lib/csso/js_lib.rb
csso-rails-0.3.3 lib/csso/js_lib.rb
csso-rails-0.3.2 lib/csso/js_lib.rb
csso-rails-0.3.1 lib/csso/js_lib.rb
csso-rails-0.3.0 lib/csso/js_lib.rb
csso-rails-0.2.0 lib/csso/js_lib.rb