
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
CSS minification with YUI compressor, but as native Ruby port.
The CSSminify gem provides CSS compression using YUI compressor. Instead of wrapping around the Java or Javascript version of YUI compressor it uses a native Ruby port of the CSS engine. Therefore this gem has no dependencies.
In basic benchmarks the Ruby version performed about as good as the Java jar. It currently passes all CSS test cases included with the YUI compressor Java source code.
Main motivation for the Ruby port and this gem was to reduce dependencies like Java.
PLEASE NOTE: This project has been forked from it's original author, with patches from r7com, and pushed to rubygems as cssminify2.
Install CSSminify2 from RubyGems:
gem install cssminify2
Or include it in your project's Gemfile:
gem 'cssminify2'
require 'cssminify2'
CSSminify2.compress('/* a comment */ .test { display: block; }')
# => minified CSS
CSSminify2.compress(File.read('path/to/styles.css'))
# => minified CSS
CSSminify2.compress(File.open('path/to/styles.css'))
# => minified CSS
# Alternatively use instance method...
compressor = CSSminify2.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):
CSSminify2.compress(File.read("path/to/styles.css"), 200)
Note: in most cases line length will only be approximated.
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 CSSminify instead, edit your config/application.rb file:
config.assets.css_compressor = CSSminify2.new
Tested with Ruby 1.9.2, 1.9.3, jruby-19mode, rbx-19mode
See CHANGES.
Copyright (c) 2012 Matthias Siegel (matthias.siegel@gmail.com) Copyright (c) 2016 Matt Spurrier (matthew@spurrier.com.au) See LICENSE for details.
See file.
FAQs
Unknown package
We found that cssminify2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.