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

gulp-track-filenames

v0.1.0

Published

Capture file names before and after transform steps so as to be able to reinstate pre-transform text.

Downloads

32

Readme

gulp-track-filenames

Capture file names before and after transform steps so as to be able to reinstate pre-transform text..

Install

Install with npm.

npm install --save-dev gulp-track-filenames

Usage

The following is an overly simplistic example. Typically you would use the replace method in an error reporter or similar.

  var gulp = require('gulp');
  var tracking = require('gulp-track-filenames')();
  
  gulp.task('copy', function() {
    var session = tracking.create()
    return gulp.src('src/js/**/*.js')
      .pipe(session.before())
      .pipe(gulp.dest('build/js'))
      .pipe(session.after());
      .on('data', function(file) {
        console.log({
          after:  file.path,
          before: tracking.replace(file.path)
        });
      });
  });

It is important to use a different session in each stream as otherwise the order can be confused and before will not match after. The replace method may be called on the session but is typically called on the top level as shown.

Reference

()

Create an instance.

@returns {{create: function, replace: function}}

.create()

Create an session that is separated from others.

This is important to ensure that order is preserved when associating before with after.

@returns {{before: function, after: function, replace: function}}

.before()

Consider file names from the input stream as those before transformation.

Outputs a stream of the same files.

@returns {stream.Through} A through stream that performs the operation of a gulp stream.

.after()

Consider file names from the input stream as those after transformation.

Order must be preserved so as to correctly match the corresponding before files.

Outputs a stream of the same files.

@returns {stream.Through} A through stream that performs the operation of a gulp stream.

.define(before, after)

Define an explicit filename transformation.

@param {string} before The filename before transformation

@param {string} after The filename after transformation

@returns The current session on which the method was called

.replace(text)

Replace occurrences of after file names with the corresponding before file names for only the current session.

@param {string} text The input text to replace.

@returns {string} The result of the replacement.

.replace(text)

Replace occurrences of after file names with the corresponding before file names across all session.

@param {string} text The input text to replace.

@returns {string} The result of the replacement.