Questions tagged [gulp-tap]

a gulp plugin that makes it easy to tap into a gulp stream.

gulp-tap is a gulp plugin that makes it easy to tap into a gulp stream.

For example, it's needed to update the contents of all Markdown files from the pipeline, but not the JavaScript files, and still output all of the files into target build folder. It can be done like that:

var gulp = require('gulp');
var tap = require('gulp-tap');

gulp.src('app/**/*.{js,md}')
  .pipe(tap(function(file) {
    if (path.extname(file.path) === '.md') {
      file.contents = new Buffer('The updated content of Markdown file!');   
    }
  }))
  .pipe(gulp.dest('./build'));
8 questions
1
vote
2 answers

How do you pass a filename to the next action in a Gulp pipeline using gulp-tap?

I have a Gulp task which takes an HTML file and inlines styles taken from a CSS file using gulp-inline-css. The original version of my task used the same CSS file for each HTML file. Now I would like to have the task choose a CSS file based on the…
elliottregan
  • 1,301
  • 1
  • 13
  • 33
1
vote
0 answers

Gulp-tap: how to use it?

I have been trying to make one of my gulp task work, but can't figure out how to use the gulp-tap for my specific case. I want to take the filename of the current processed amp-html file and use it to import the css file with the same name into the…
brclz
  • 806
  • 9
  • 23
1
vote
1 answer

Gulp: replace variables in HTML file based on file name

Our project is using Gulp. Now I have a requirement: we have multiple page-level HTML files, say login.html and my.html. Inside these original HTML files there is a variable called {{PAGE_TITLE}}, which should be replaced (by Gulp) to be "Login to…
Joy
  • 9,430
  • 11
  • 44
  • 95
1
vote
1 answer

Is it possible to convert stream to buffer synchronously?

Look at the simplest Gulp task that uses gulp-tap: var gulp = require('gulp'); var tap = require('gulp-tap'); gulp.task('mytask', function () { return gulp.src("src/*/*.js") .pipe(tap(function (file) { file.contents =…
Taras Hupalo
  • 1,337
  • 2
  • 16
  • 29
0
votes
1 answer

Use gulp to copy the contents of one glob file into a line of another glob file

I'm working on a web component build process that takes the contents of a HTML file and puts them into a string in my javascript file. I want to get the contents of /src/foo/bar.html and add them to /dist/foo/bar.js At the moment, I'm using gulp-tap…
0
votes
1 answer

Switch output folder based on filename in gulp task

I have different *.scss files in my src folder and I want one file to be compiled in its own separate folder. Lets assume I have the files normalFile_1.scss, specialFile.scss, normalFile_2.scss. I want the two normal files to be compiled to the…
0x1234
  • 101
  • 2
  • 11
0
votes
1 answer

Gulp control output based on data from an earlier pipe

I have been trying to find a way with gulp to only write out certain files based on yaml data I am collecting in the pipe. I have been able to see the file's data, but not able to get the output I expect. In this task, I am collecting a glob of…
AGarrett
  • 79
  • 1
  • 1
  • 8
0
votes
2 answers

How do I get the base filename and pass that as a variable down the pipe in gulp?

I'm trying to grab the base name of each html file that passes through a stream. The code here obviously doesn't work because _base is no longer in scope. It seems like there should be a really easy way to do this, or maybe there's something built…
leecsargent
  • 151
  • 1
  • 1
  • 11