File: cssminify.rb

package info (click to toggle)
ruby-cssminify 1.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 992 kB
  • sloc: ruby: 391; makefile: 6
file content (34 lines) | stat: -rw-r--r-- 770 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# coding: utf-8

require "cssminify/cssmin"
require "cssminify/version"

class CSSminify
  
  def initialize
  end
  
  
  #
  # Compress CSS with YUI
  #
  # @param [String, #read] CSS String or IO-like object that supports #read
  # @param [Integer] length Maximum line length
  # @return [String] Compressed CSS
  def self.compress(source, length = 5000)
    self.new.compress(source, length)
  end
  
  
  #
  # Compress CSS with YUI
  #
  # @param [String, #read] CSS String or IO-like object that supports #read
  # @param [Integer] length Maximum line length
  # @return [String] Compressed CSS
  def compress(source = '', length = 5000)
    source = source.respond_to?(:read) ? source.read : source.to_s
    
    CssCompressor.compress(source, length)
  end
end