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-continuous-concat

v0.1.1

Published

Continuously concatenates files (makes gulp-watch useful again for concated files)

Downloads

41

Readme

Information

Usage

var watch = require('gulp-watch');
var concat = require('gulp-continuous-concat');

gulp.task('scripts', function() {
  gulp.src('./lib/*.js')
    .pipe(watch({glob: './lib/*.js'}))
    .pipe(concat('all.js'))
    .pipe(gulp.dest('./dist/'))
});

This will continously concat files by your operating systems newLine. This differs from the standard gulp-concat plugin in that it does not require previous streams to emit an end to work. The typical use case for this plugin is after using gulp-watch, which does not emit an end. This prevents normal gulp-concat from ever finishing. Using the above example with standard gulp-concat, the concatenated file would never be created:

var watch = require('gulp-watch');
var concat = require('gulp-concat');   // <-- standard gulp-concat

gulp.task('scripts', function() {
  gulp.src('./lib/*.js')
    .pipe(watch({glob: './lib/*.js'})) // <-- will never emit 'end'
    .pipe(concat('all.js'))            // <-- sits around forever, waiting for 'end'
    .pipe(gulp.dest('./dist/'))
});

gulp-continuous-concat gets around this by rebuilding the destination file on every incoming file. To avoid excessive rebuilding (for example, when first running the command on several files), it debounces the build step so it will only run after 100ms of not being called (the debouncing period is configurable via the debounce option on the options hash).

Files will be concatenated in the order that they are supplied, and will maintain that order even if one of those files is later re-emitted from upstream. For example, to concat ./lib/file3.js, ./lib/file1.js and ./lib/file2.js in that order, the following code would create a task to do that:

var concat = require('gulp-continuous-concat');

gulp.task('scripts', function() {
  gulp.src(['./lib/file3.js', './lib/file1.js', './lib/file2.js'])  // <-- emits the files in order
    .pipe(watch())                                                  // <-- later, ./lib/file1.js changes and re-emitted from here
    .pipe(concat('all.js'))                                         // <-- continuous-concat maintains the original gulp.src order
    .pipe(gulp.dest('./dist/'))
});

Limitations

Because gulp-watch does not emit files that were deleted, if you add a continuous concat step after a gulp-watch, and then delete a file, it will not be removed from the concatentated result.

If and when gulp-watch adds this functionality, this plugin could be updated to remove deleted files from the result.

LICENSE

Apache 2.0 (See LICENSE file for full details)