1. gulp-file
Create vinyl files from a string or buffer and insert into the Gulp pipeline.
gulp-file
Package: gulp-file
Created by: alexmingoia
Last modified: Sat, 18 Jun 2022 17:04:14 GMT
Version: 0.4.0
License: BSD
Downloads: 85,615
Repository: https://github.com/alexmingoia/gulp-file

Install

npm install gulp-file
yarn add gulp-file

gulp-file

Build Status
NPM version

Create vinyl files from a string or buffer and insert into the Gulp pipeline.

Installation

 npm install gulp-file

API

plugin(name, source, options)

Creates a vinyl file with the given name from source string or buffer and
returns a transform stream for use in your gulp pipeline.

plugin(sourceArray, options)

Creates vinyl files for each entry in the array. Each entry is an object with a name and source property. A vinyl file is created with the given name and source and inserted into the returned transform stream.

Example

Primus outputs the client library as a string. Using gulp-file we can
create a vinyl file from the string and insert it into the gulp pipeline:

 var gulp = require('gulp')
  , file = require('gulp-file');

gulp.task('js', function() {
  var str = primus.library();

  return gulp.src('scripts/**.js')
    .pipe(file('primus.js', str))
    .pipe(gulp.dest('dist'));
});

Use it at the beginning of your pipeline by setting src: true:

 var gulp = require('gulp')
  , file = require('gulp-file');

gulp.task('js', function() {
  var str = primus.library();

  return file('primus.js', str, { src: true })
    .pipe(gulp.dest('dist'));
});

Options

src

Calls stream.end() to be used at the beginning of your pipeline in place of
gulp.src(). Default: false.

BSD Licensed

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code