Sha256: a76bad7138f125aab8a84a6f04415f4ecaf49042dd01d9dc2cfc3a6c9840fcac

Contents?: true

Size: 742 Bytes

Versions: 9

Compression:

Stored size: 742 Bytes

Contents

require 'sass'
require 'uglifier'
require 'front-compiler'

module Alula
  module Compressors
    class CSSCompressor
      def compress(content)
        if content.count("\n") > 2
          Sass::Engine.new(content,
            :syntax => :scss,
            :cache => false,
            :read_cache => false,
            :style => :compressed).render
        else
          content
        end
      end
    end
    
    class JSCompressor
      def compress(content)
        @@compressor ||= Uglifier.new
        @@compressor.compress(content)
      end
    end
    
    module HTMLCompressor
      def output_with_compression
        @@compressor ||= FrontCompiler.new
        @@compressor.compact_html(@output)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
alula-0.2.3 lib/alula/compressors.rb
alula-0.2.1 lib/alula/compressors.rb
alula-0.2.0 lib/alula/compressors.rb
alula-0.2.0c lib/alula/compressors.rb
alula-0.2.0a lib/alula/compressors.rb
alula-0.1.4 lib/alula/compressors.rb
alula-0.1.3 lib/alula/compressors.rb
alula-0.1.1 lib/alula/compressors.rb
alula-0.1.0 lib/alula/compressors.rb