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

@zilero/gulp-file-changed

v2.1.0

Published

Pass only the files that changed since the last build, by modification time or contents, so watch builds skip the rest.

Readme

@zilero/gulp-file-changed

Pass only the files that changed since the last build, by modification time or contents, so watch builds skip the rest.

npm install size node license docs

Each file is compared with the file the build wrote for it last time: missing, older or different, it passes; otherwise it is dropped. Put it right after src so untouched files skip the rest of the pipeline. Replaces gulp-changed and gulp-newer.

  • Finds the built file when the build renames it: a new extension (.scss → .css) or any path from a function.
  • Compares modification times in whole milliseconds, so files dest just wrote do not look newer than their sources.
  • extra globs (Sass partials, a config) count as a dependency of every file.
  • 'contents' mode for copy-as-is builds, or your own comparison.
  • Typed options, validated when the plugin is created.

Install

npm install --save-dev @zilero/gulp-file-changed
# pnpm add -D @zilero/gulp-file-changed · bun add -d @zilero/gulp-file-changed

gulp is not a dependency: the plugin works with the gulp your project already has.

Usage

// gulpfile.ts
import { fileChanged } from '@zilero/gulp-file-changed';
import { imageSqueezer } from '@zilero/gulp-image-squeezer';
import { dest, src } from 'gulp';
import { pipeline } from 'node:stream/promises';

export const images = (): Promise<void> =>
  pipeline(
    src('src/images/**', { encoding: false }),
    fileChanged({ dest: 'dist/images' }),
    imageSqueezer(),
    dest('dist/images')
  );

In CommonJS: const { fileChanged } = require('@zilero/gulp-file-changed'). The default export is the same function.

Options

| Option | Type | Default | Description | | --------- | -------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | dest | string \| ({ file }) => string | — | Required. The folder dest writes to, relative to file.cwd or absolute: the same value you give dest, or a function of the file. | | extname | string | — | The extension of the built file when the build changes it, with its dot: '.css' for .scss sources. | | target | ({ file }) => string | — | The built file's path, relative to dest or absolute, for builds that rename files in other ways. Wins over extname. | | extra | string \| string[] | — | Globs, relative to file.cwd, of files every file depends on. When the newest of them is newer than a file's built file, the file passes. | | compare | 'mtime' \| 'contents' \| ({ file, target: { path, stat } }) => boolean \| Promise<boolean> | 'mtime' | How a file counts as changed: newer than the built file, different bytes, or your function returns true. |

Options are validated when the plugin is created: unknown keys and an extension without its dot ('css') are errors.

How a file is checked

  1. Directories pass.
  2. The built file is dest + the path relative to file.base (with extname swapped in), or target's path. If it does not exist, the file passes. A dest that points at a file instead of a folder counts as not built.
  3. If the newest extra file is newer than the built file, the file passes.
  4. Otherwise compare decides; an unchanged file is dropped.

'mtime' compares whole milliseconds; files without a stat always pass. 'contents' compares bytes and only fits builds that copy files as they are: when the build changes the file (minifies, compiles), the built file never equals its source, so every file passes every time. Files without Buffer contents always pass with 'contents'.

dest, target and compare get one object with the Vinyl file. dest and target must return a string, not a promise; compare may be async. The extra globs are resolved once per stream run, so each watch run sees the current files.

Files and errors

  • Every file is checked, whatever its type; files that pass are not changed.
  • A missing built file lets the file through. Any other error while checking it, such as a permission error, fails the task with a PluginError from @zilero/gulp-file-changed, and so does an error thrown by dest, target or compare.
  • Not for plugins that combine files (concat, archives): they need every file, not only the changed ones.

Recipes

Sass, with partials as dependencies:

pipeline(
  src('src/scss/*.scss', { sourcemaps: true }),
  fileChanged({ dest: 'dist/css', extname: '.css', extra: 'src/scss/**/_*.scss' }),
  scssCompiler(),
  dest('dist/css', { sourcemaps: '.' })
);

Responsive images with a suffix:

fileChanged({ dest: 'dist', target: ({ file }) => `images/${file.stem}-1280w.jpg` });

Copy static files as they are, by contents:

pipeline(src('static/**', { encoding: false }), fileChanged({ dest: 'dist', compare: 'contents' }), dest('dist'));

Migrating from gulp-changed and gulp-newer

| gulp-changed / gulp-newer | file-changed | | ---------------------------------------------------------------- | -------------------------------------------- | | changed('dist'), newer('dist') | fileChanged({ dest: 'dist' }) | | changed(dest, { extension: '.css' }), newer({ ext: '.css' }) | extname: '.css' | | transformPath, newer({ map }) | target: ({ file }) => path | | hasChanged: changed.compareContents | compare: 'contents' | | hasChanged: changed.compareLastModifiedTime | compare: 'mtime' (the default) | | a custom hasChanged | compare: ({ file, target }) => boolean | | newer({ extra }) | extra | | newer('dist/bundle.js') (many sources, one file) | not supported: run concat-like tasks in full |

New in 2.0: there was no 1.x of this package.

Requirements

  • Node.js 22.13+
  • gulp 5 (gulp 4 works too)
  • ESM with TypeScript types; require() works through Node's require(esm)
  • No engine: built on node:fs

Documentation · Changelog · All plugins · Issues

MIT © Artemev Alexandr