Git Product home page Git Product logo

css_sprites's Introduction

CSS Sprites

CSS Sprites is a Ruby gem that finds all PNG files in the input directory, merges them together into a single PNG file and generates a CSS stylesheet for the output image.

Prerequisites

ImageMagick Version 6.4.9 or later. You can get ImageMagick from www.imagemagick.org.

Or, if you're on Mac OS X and using Homebrew, you can install it by typing:

$ brew install imagemagick

And if you're using Ubuntu:

$ sudo apt-get install libmagickwand-dev

Installation

Add this line to your application's Gemfile:

gem 'css_sprites'

And then execute:

$ bundle install

Or install it yourself:

$ gem install css_sprites

Usage

In your Ruby app:

require 'css_sprites'
CSSSprites.generate_sprite(path_to_images, options_hash)

Or from the command line:

$ css_sprites path/to/images

Options

Option Type Default Description
stacking horizontal or vertical horizontal How to order images in the sprite
output string input directory's parent's path Where to save the generated files
name string input directory's name A name for the base CSS class (and the generated files)

Examples with options

In your Ruby app:

options = {
    stacking: :vertical,
    name: 'so_awesome',
    output: 'my_awesome_icons_output'
}
CSSSprites.generate_sprite('my_awesome_icons', options)

From the command line:

$ css_sprites --stacking vertical --name so_awesome --output my_awesome_icons_output my_awesome_icons

For more details:

$ css_sprites --help

css_sprites's People

Contributors

angelikatyborska avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.