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 🙏

© 2024 – Pkg Stats / Ryan Hefner

spritestream

v0.2.0

Published

images go in, sprites come out

Downloads

4

Readme

spritestream

Build Status

spritestream reads from a stream of retina and non-retina image files and spits out sprite sheets and an accompanying CSS file. It is designed for use with Gulp.

Usage

Pipe your source files into spritestream, and provide a callback. The callback will receive either an error or an array of results with the non-retina sprite image, the retina sprite image, and the CSS file, in that order.

spritestream assumes that for each image.png, there is an accompanying [email protected] for use in the retina sprite sheet.

var es           = require('event-stream');
var gulp         = require('gulp');
var spritestream = require('spritestream');

gulp.src('./images/**/*.png').pipe(spritestream(function(err, results) {
  if (err) { throw err; }
  es.readArray(results).pipe(gulp.dest('./public'));
}));

Options

cssClass

Use a custom CSS class. By default, classes will be named like .icon and .icon-image-name. These can be changed to .sprite and .sprite-image-name, for example, by passing sprite.

digest

Set to true to append an md5 hash of the file contents to the end of its name.

imagesPath

The path, relative to the ultimate pipe destination, to attach to the image Vinyl file objects.

cssPath

The path, relative to the ultimate pipe destination, to attach to the CSS Vinyl file objects.

template

Provide a template to use other than the default one. This will be compiled with EJS. See the existing template in templates/sprites.css.ejs for an example. Can be a string or a Buffer.

Example

This example will result in the following files:

  • ./public/images/sprites-34509438543098abcde.png
  • ./public/images/[email protected]
  • ./public/stylesheets/sprites-styles-2340823049823094098.css
gulp.src('./images/**/*.png').pipe(spritestream({
  cssClass  : 'sprite',
  digest    : true,
  imagesPath: './images/sprites',
  cssPath   : './stylesheets/sprites-styles'
}, function(err, results) {
  es.readArray(results).pipe(gulp.dest('./public'));
});

Installation

npm install spritestream --save

Tests

Automated tests:

npm test

Manual tests:

npm run test-server

Credits

The icons used in the test suite—"Watch", "Breakfast", "Sketchbook", and "Twinkie"—were designed by Edward Boatman from thenounproject.com.