Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Give vinyl files arbitrary chunk names, using through2, with type declarations.

Notifications You must be signed in to change notification settings

roydukkey/vinyl-named2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vinyl-named2

Release Version License

Give vinyl files arbitrary chunk names, using through2, with type declarations.

Usage

const named = require('vinyl-named2');
const fs = require('vinyl-fs');
const through = require('through2');

fs.src('src/*.js')
  .pipe(named())
  .pipe(through.obj((file) => {
    // file.named now equals the basename minus the extension.
  }));

// Or, return a name for a given file.
fs.src('src/*.js')
  .pipe(named((file) => 'your own name'));

// Or, specify a custom name property.
fs.src('src/*.js')
  .pipe(named(function (file) {
    file.customName = 'your name';
    this.push(file);
  }));

TypeScript

import named from 'vinyl-named2';
import * as fs from 'vinyl-fs';
import * as through from 'through2';

fs.src('src/*.js')
  .pipe(named())
  .pipe(through.obj((file) => {
    // file.named now equals the basename minus the extension.
  }));

// Or, return a name for a given file.
fs.src('src/*.js')
  .pipe(named((file) => 'your own name'));

// Or, specify a custom name property.
fs.src('src/*.js')
  .pipe(named(function (this, file) {
    file.customName = 'your name';
    this.push(file);
  }));

About

Give vinyl files arbitrary chunk names, using through2, with type declarations.

Resources

Stars

Watchers

Forks

Sponsor this project