Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

gulp-track-filenames

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-track-filenames

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

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

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.

Keywords

gulpplugin

FAQs

Package last updated on 13 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts