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

chris-images-sprite

v0.1.1

Published

A super plugin for images sprite that generates.

Downloads

37

Readme

Installation

$ npm i chris-images-sprite -D

插件功能

1. 监听目标目录变化
2. 正则提取图片:/\.(png|jpe?g)(\?.*)?$/
3. 合理填充sprite画布

插件优点

1. 比传统方式更加容易维护(想换哪张图直接换掉,会自动管理样式和sprite图)
2. 在客户端减少http的请求
3. 优雅的优化了代码量

调用


/**
 * @param config {object} 配置参数:
 * 
 * @param spritepath {string} 样式文件北京图片链接sprite图的路径
 * @param rowcount {number} 第一行最大放几张图 (因为需要利用第一行的总宽度来创建sprite图的场景尺寸)
 * @param listenpath {string} 监听目录
 * @param outfilepath {string} 输出文件到达的目录 (sprite图片和css文件会被输出到这里)
 * @param margin {number} 外边界距离平分到四边 每边=10/2
 * @param quality {number} 图片压缩值 值越小图片质量越小
 * @param suffixname {string} 样式文件扩展名 支持:less sass css等
 * @param name {string} 可以任意添加生成文件的后缀名
 * 
**/

const AutoSprite = require("chris-images-sprite");

new AutoSprite({
    rowcount: 5,
    margin: 10,
    quality: 90,
    spritepath: "./",
    listenpath: `./common/assets`,
    outfilepath: `./common/less/sprites`
});

##PS:

"listenpath" !== "outfilepath" 请不要把输出文件的路径输入到监听目录中,因为这样会造成循环监听。

if you like it,thank you。

License

MIT