All Projects → Vasfed → Csso Rails

Vasfed / Csso Rails

CSS Optimizer(csso) ruby wrapper for Rails Asset pipeline

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Csso Rails

Model Optimization
A toolkit to optimize ML models for deployment for Keras and TensorFlow, including quantization and pruning.
Stars: ✭ 992 (+1053.49%)
Mutual labels:  optimization, compression
Optimus
Image conversion and optimization desktop app.
Stars: ✭ 111 (+29.07%)
Mutual labels:  optimization, compression
Fast zlib
Heavily optimized zlib compression algorithm
Stars: ✭ 105 (+22.09%)
Mutual labels:  optimization, compression
Meshoptimizer
Mesh optimization library that makes meshes smaller and faster to render
Stars: ✭ 2,930 (+3306.98%)
Mutual labels:  optimization, compression
libcaesium
The Caesium compression library written in Rust
Stars: ✭ 58 (-32.56%)
Mutual labels:  compression, optimization
image-optimizer
Smart image optimization
Stars: ✭ 15 (-82.56%)
Mutual labels:  compression, optimization
Georaptor
Python Geohash Compression Tool
Stars: ✭ 143 (+66.28%)
Mutual labels:  optimization, compression
Imager
Automated image compression for efficiently distributing images on the web.
Stars: ✭ 266 (+209.3%)
Mutual labels:  optimization, compression
Tris Webpack Boilerplate
A Webpack boilerplate for static websites that has all the necessary modern tools and optimizations built-in. Score a perfect 10/10 on performance.
Stars: ✭ 1,016 (+1081.4%)
Mutual labels:  optimization, compression
Snibox
Self-hosted snippet manager
Stars: ✭ 1,247 (+1350%)
Mutual labels:  rails
Graphjin
GraphJin - Build APIs in 5 minutes with GraphQL. An instant GraphQL to SQL compiler.
Stars: ✭ 1,264 (+1369.77%)
Mutual labels:  rails
Fossildelta
An efficient delta compression algorithm written in C#
Stars: ✭ 82 (-4.65%)
Mutual labels:  compression
Pluck all
A more efficient way to get data from database. Like #pluck method but return array of hashes instead.
Stars: ✭ 83 (-3.49%)
Mutual labels:  rails
Training Material
A collection of code examples as well as presentations for training purposes
Stars: ✭ 85 (-1.16%)
Mutual labels:  optimization
Turkish support
Turkish character support for core ruby methods.
Stars: ✭ 82 (-4.65%)
Mutual labels:  rails
Rails React Boilerplate
Ruby on Rails, React, Webpack 4 boilerplate app.
Stars: ✭ 86 (+0%)
Mutual labels:  rails
Rails docker template
Docker template for Rails app or Rails + Webpacker app development.
Stars: ✭ 82 (-4.65%)
Mutual labels:  rails
Classroom
GitHub Classroom automates repository creation and access control, making it easy for teachers to distribute starter code and collect assignments on GitHub.
Stars: ✭ 1,243 (+1345.35%)
Mutual labels:  rails
Compress.js
A simple JavaScript based client-side image compression algorithm
Stars: ✭ 86 (+0%)
Mutual labels:  compression
Chaskiq
A full featured Live Chat, Support & Marketing platform, alternative to Intercom, Drift, Crisp, etc ...
Stars: ✭ 1,263 (+1368.6%)
Mutual labels:  rails

csso-rails: Stylesheet Optimizer (CSSO) for Rails Asset pipeline

Gem Version Build Status

Ruby adapter for github.com/css/csso.

CSSO does structure-optimization for CSS. CSS is usually reduced more than in half in uncompressed and around 15% in gzipped.

A Real-World Example

A living rails application CSS – some written in less, some handwritten):

Original sass yui 2.4.7 csso % of original
Plain 129497 107006 60758 60874 47%
GZipped 14046 12047 10558 10472 74%

Very close to yui compressor, wining in gzipped (you’re using nginx mod\_gzip_static, don’t you?)

A more hard example – twitter bootstrap.css, already minified:

Original lessc yui 2.4.7 csso % of original
Plain 81443 71520 68755 67679 83%
GZipped 12384 11633 11652 11477 92%

Please note than benchmark was taken in summer of 2012, since then things may have changed.

Usage

In Rails 3.1+

Add gem 'csso-rails' to your gemfile, and that’s it! (also you may want to add some javascript runtime for ExecJS to pick up, like gem 'therubyracer')

Upon including it becomes the default compressor even if sass is included too. More explicit way – set in config/environment/production.rb:

config.assets.css_compressor = :csso

Sprockets

If you use Sprockets without Rails:

require 'csso'
Csso.install(sprockets_env)

In Plain Ruby

require 'csso'
puts Csso.optimize("a{ color: #FF0000; }") # produces "a{color:red}"

In maniac mode (Csso.optimize(css, true), default for pipeline) CSS is processed several times until it stops getting lighter (there're cases when original csso does not do all optimizations for no reason).

In Command Line

ruby_csso non_optimized.css > optimized.css

MIT-License

Original CSSO code - Copyright (C) 2011 by Sergey Kryzhanovsky.

ruby gem - Copyright(C) 2012 Vasily Fedoseyev

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].