🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

yuicssmin

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yuicssmin

bundlerRubygems
Version
1.0.2
Version published
Maintainers
1
Created
Source

YUICSSMIN Build Status

Ruby wrapper for the Javascript port of YUI's CSS compressor.

The YUICSSMIN gem provides CSS compression using YUI compressor from Yahoo. Unlike other gems it doesn't use the Java applet YUI compressor but instead uses the Javascript port via ExecJS.

Installation

Install YUICSSMIN from RubyGems:

gem install yuicssmin

Or include it in your project's Gemfile:

gem 'yuicssmin'

Usage

require 'yuicssmin'

Yuicssmin.compress(File.read("path/to/styles.css"))         # => minified CSS

# Alternatively use instance method...

compressor = Yuicssmin.new
compressor.compress(File.read("path/to/styles.css"))        # => minified CSS

Files or strings are acceptable as input.

You can pass in a second argument to control the maximum output line length (default 5000 characters):

Yuicssmin.compress(File.read("path/to/styles.css"), 200)

Note: in most cases line length will only be approximated.

Rails asset pipeline

Rails 3.1 integrated Sprockets to provide asset packaging and minimising out of the box. For CSS compression it relies on the yui-compressor gem which requires Java. To use YUICSSMIN instead, edit your config/application.rb file:

config.assets.css_compressor = Yuicssmin.new

Compatibility

Tested with Ruby 1.9.2, 1.9.3, jruby-19mode, rbx-19mode

Changelog

See CHANGES.

Credits

YUICSSMIN gem was inspired by Ville Lautanala's Uglifier gem, released under MIT license.

YUICSSMIN gem and documentation

Copyright (c) 2012 Matthias Siegel (matthias.siegel@gmail.com) See LICENSE for details.

YUI compressor

See file.

FAQs

Package last updated on 20 Jul 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts