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

sew-many-images

v1.0.5

Published

responsive css sprites generator

Downloads

3

Readme

Sew Many Images

npm GitHub GitHub forks

100% JavaScript implementation for CSS image sprite generator. Have a suggestion/improvement? Please submit an PR or Issue.

Optional Dependency: In the repo where you run this command, you can install app-root-path to consistently generate the same hash for CSS class prefixes, as we use the location of your image directory to generate these hashes. If app-root-path doesn't exist, we will just use your current working directory. Therefore, the same repo on a different directory in the same machine will generate different hashes, but it will still work regardless.

Todo:

  • [ ] Add flag to resize images before stitching together

Quick start guide

Run git clone https://github.com/Shopee/sew-many-images.git && cd sew-many-images && npm install && npm run build && npm install -g

Or:

  • Clone this repo git clone https://github.com/Shopee/sew-many-images.git
  • Change directory to the repo cd sew-many-images
  • Install dependencies npm install
  • Build project npm run build
  • Globally install npm install -g

Or:

npm install -g sew-many-images

Or:

  • npm install -D sew-many-images
  • npx smi

User guide

Change directory to where your images are and generate 3 files with smi in your current working directory

  • sprite.png
    • Generated CSS sprites, greedily arranged into the (reasonably) smallest rectangle
  • images.js
    • A JS file which exports react components with background-image as the respective images. The components will be named Image${filename}. You should be able to resize these components and the images will be accordingly responsive
  • style.scss
    • A CSS file which defines the classes for the images. You will not need to modify this in most cases.

Commands and flags

|Command|Shorthand|Description| |:---|:---|:---| |--help|N.A.|If you need to read the docs to understand what this does, maybe you should refresh on your CLI skills| |--from|-f|Directory of images to stitch. By default it will crawl through your current working directory| |--dir|-d|Output directory same as images. By default it will generate the files in your current working directory, but turning this flag to true will generate the files in your images directory| |--pad|-p|Padding between images. You can increase this if the images bleed into each other| |--genHtml|--gh|Generate html file. Off by default. It is good to turn on this flag if you want to check the styles generated and whether they bleed, without using the actual React components| |--genReact|--gr|Generate JS file with React components. You can import these components and resize them (override the height and width), they will scale accordingly| |--styleName|-s|Stylesheet name (default 'style.scss') on chrome. SCSS will not load on the generated html page, otherwise there's no need to change this| |--reactPrefix|-r|React component prefix (default 'image'). There's no need to change this unless the import names are getting ridiculously long| |--out|-o|Output image name. There's no need to change this, will not affect development| |--stylePrefix|N.A.|CSS class prefix. By default we will generate a crc32-base36 of the image directory (with prefix 'p', to avoid bad className). There's no need to change this, will (likely) not affect development, but there's a possibility of hash collision| |--indentSp|N.A|CSS class indent rules with (default two spaces ' '). Change this if it doesn't work with your css linting rules|

With ❤ from tenzy

Copyright 2018 Ten Zhi Yang

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.