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

@ilabdev/images

v1.0.1

Published

Gulp tasks for optimizing images

Downloads

10

Readme

@ilabdev/images

Gulp tasks for optimizing images

Installation & set up

Install @ilabdev/images

npm install @ilabdev/images --save-dev

-- OR --

yarn add @ilabdev/images --dev

Include @ilabdev/images in your gulpfile.js

NOTE: Make sure you pass gulp through to the package as shown below. The package sets up gulp tasks and will need it passed through to work.

require( '@ilabdev/images' )( gulp )

Add the content from config.sample.js to your .gulpconfig.js and adjust as appropriate

module.exports = {
    // Other configs here...
    images: {
        process: true,
        watch: true,
        logColor: 'green',
        areas: [
            {
                paths: {
                    src: './src/images/**/*',
                    watch: './src/images/**/*',
                    dest: './dist/images',
                },
                pipes: {
                    // Put any pipe overrides here
                    src: {
                        allowEmpty: true,
                        base: './src/images',
                    },
                    dest: {},
                },
            },
        ],
        pipes: {
            watch: {
                events: 'all',
            },
            sharp: {
                sharpOptions: {
                    limitInputPixels: false,
                },
                compressOptions: {
                    avif: {
                        quality: 33,
                        effort: 6,
                    },
                    gif: {
                        progressive: false,
                        colors: 256,
                        effort: 7,
                    },
                    jpeg: {
                        quality: 75,
                        progressive: true,
                        mozjpeg: true,
                    },
                    png: {
                        compressionLevel: 6,
                        progressive: true,
                        quality: 100,
                    },
                    tiff: {
                        quality: 80,
                        compression: 'jpeg',
                    },
                    webp: {
                        quality: 75,
                    },
                },
                sizes: [],
            },
            svgo: {
                multipass: true,
                plugins: [
                    'sortAttrs',
                    {
                        name: 'removeViewBox',
                        active: false,
                    },
                    {
                        name: 'cleanupIDs',
                        params: {
                            minify: true,
                        },
                    },
                ],
            },
        },
    },
    // Other configs here...
}

Run gulp images to run the image optimization task, gulp images:watch to run the watch task, or add the task as a script and run that with npm or yarn

Config

process

Type: boolean

Whether to optimize images or not

watch

Type: boolean

Whether to watch images for changes or not

loggerColor

Type: string

The logger color to use for any output text. See https://github.com/stgdp/fancy-logger#available-modifiers for colors that can be used

areas

Type: object[]

The areas to be optimized. Each area has it's own, isolated settings to allow for separate configs

areas[].paths

Type: object

Path references for the image optimizer

areas[].paths.src

Type: string[]|string

The paths to optimized. Passed through to gulp.src, items can be globs

areas[].paths.watch

Type: string[]|string

The paths to watched. These are combined into a single array and passed through to gulp.watch

areas[].paths.dest

Type: string

The destination path of the optimized images. Passed through to gulp.dest, items can be globs

areas[].pipes

Type: object

Options to be passed through to the pipes.

areas[].pipes.src

Type: object

Options to be passed through to the gulp.src pipe. See https://gulpjs.com/docs/en/api/src/ for more information

areas[].pipes.dest

Type: object

Options to be passed through to the gulp.dest pipe. See https://gulpjs.com/docs/en/api/dest/ for more information

pipes

Type: object

Options to be passed through to the pipes.

pipes.watch

Type: object

Options to be passed through to the gulp.watch pipe. See https://gulpjs.com/docs/en/api/watch/ for more information

pipes.sharp

Type: object

Options to be passed through to the gulp-optimize-images pipe. See https://www.npmjs.com/package/gulp-optimize-images for more information

pipes.svgo

Type: object

Options to be passed through to the gulp-svgmin pipe. See https://www.npmjs.com/package/gulp-svgmin for more information