npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

postcss-cyspriter

v0.0.6

Published

PostCSS Plugin for Working With Sprites

Readme

postcss-cyspriter

PostCSS plugin that creates sprites using css rules prefixed by cys-.

What you need is just to write your css rule using cys- prefix and assign it the cys-src required declaration. That's All.

/* Input example */
.cys-[className] {
    cys-src: [folderName];
}
/* Output example */
.className,
.className-imagename {
    background-image: url("/[httpDest]/[spriteName].png[?cacheBuster]");
}

.className-imagename {
  background-position: 168px 171px;
}

Usage

Installation

$ npm i [--save] postcss-cyspriter

Configuration

let cyspriterOptions = {
    src: './examples/images',
    dest: './examples/sprites',
    relativeTo: './examples/dist'
  };
  
postcss([ 
  require('postcss-cyspriter')(cyspriterOptions) 
])

Options

Required

Global

  • src {string} - Full (or relative) file system path where sprite-folders are kept.
  • dest {string} - Full (or relative) file system path where generated sprites must be saved
  • relativeTo {string} - Full (or relative) file system path usable in output css

Local

  • cys-src {string} - The directory name that contains all images that will compose the sprite, this property will be merged with the global srcoption (src = path.join(global.src, src);)
  • cys-debug {boolean} - Enables debug info for sprite instance

Optional

  • verbose {boolean} [verbose = false] - Decides whether or not to print additional debug info in console
  • cacheBuster {boolean} [cacheBuster = true] - Append a query string to the sprite to prevent cache
  • httpDest {string} [httpDest = ''] - Full web server path where generated sprites are deployed, if provided the relativeTo option will be ignored
  • padding {integer} [padding = 0] - Spacing in pixel between each image
  • retina {boolean} [retina = false] - Allows support for retina displays
  • ratio {number} [ratio = 2] - Defines the ratio to be applied to images retina
  • includeSize {boolean} [includeSize = true] - Decides whether or not to include the dimensions in the output rules
  • decorate {boolean} [decorate = true] - Decides whether or not to include useful declarations in the output rules
  • layout {string} [layout = 'smart'] - Sets the layout of the generated sprite. Possible values are: 'diagonal', 'vertical', 'horizontal', 'smart'

NOTE: except for httpDest and verbose options, each option can be overridden for sprite instance using the cys- prefix. Example:

.cys-icons {
	cys-src: 'icons';
	cys-padding: 5px;
	cys-include-size: false;
	cys-layout: 'vertical';
	...
}

NOTE: magic selectors are supported.

If cyspriter finds an image with (hover|active|focus|target) in the filename, a pseudo-selector will be generated. Example:

considering a filename as follows: foo_active.png;

cyspriter generates a rule like this:

.[spritemap]-foo:active { ... }

See PostCSS docs for examples for your environment.

Authors

| Contributor | Type | E-mail | |-------------|------|--------| | Luca Pau | author | [email protected] | | Giuseppe Mandato | author | [email protected] |


Copyright

Copyright (c) 2015 Code-Y - Luca Pau, Giuseppe Mandato. See LICENSE for details.