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

webpack-streaming-task-plugin

v0.2.1

Published

Execute streaming tasks during Webpack compilation

Downloads

3

Readme

Webpack Streaming Task Plugin

Execute tasks during Webpack compilation

NPM

Overview

This plugin executes streaming tasks during Webpack compilation, and can be used to easily leverage Gulp plugins while using Webpack.

Installation

Install the plugin with npm:

$ npm install webpack-streaming-task-plugin --save-dev

Or with Yarn:

$ yarn add webpack-streaming-task-plugin --dev

Basic Usage

The example below uses gulp-cssnano and gulp-rename to minify and rename a CSS file that is separate from the main Webpack bundle.

const WebpackStreamingTaskPlugin = require('webpack-streaming-task-plugin');
const cssnano = require('gulp-cssnano');
const rename = require('gulp-rename');

const WebpackConfig = {
  entry: './src/js/index.js',
  output: {
    path: 'dist/js',
    filename: 'index_bundle.js',
  },
  plugins: [
    new WebpackStreamingTaskPlugin({
      name: 'Minify and Rename CSS',
      source: './src/css/stylesheet.css',
      destination: './dist/css',
      task: (task) => {
        return task
          .pipe(cssnano())
          .pipe(rename({
            suffix: '.min',
          }));
      },
    }),
  ]
}

Options

The options object can contain the following properties:

  • source: (String or Array) Glob string or array of glob strings describing task input.
  • destination: (String) Destination path for task output. Set to null to prevent piping output to the filesystem. (Optional, default './')
  • task: (Function) Task function. Includes a task parameter with which to pipe output.
  • name: (String) Name of task, used in log output (Optional)
  • watchMode: (Object) Configuration object for options related to Webpack's watch mode. (Optional)
  • watchMode.includeSourceDirectories: (Boolean) Only applies in watch mode. By default, Webpack only watches for changes to the files specified by source, but directory-level changes (new files, new child directories, etc.) are ignored. When includeSourceDirectories is true, changes to any directories that contain files specified in source will trigger recompilation. (Optional, default false)
  • watchMode.skipInitialRun: (Boolean) Only applies in watch mode. When true, this task is not executed upon Webpack's initial run. Instead, it will only run once changes to its source files are detected. (Optional, default false)
  • watchMode.alwaysRun: (Boolean) Only applies in watch mode. When true, this task is always executed when Webpack runs, even if files specified in source are unchanged. If watchMode.skipInitialRun is also true, skipInitialRun takes priority and the first run will be skipped despite alwaysRun being true. (Optional, default false)
  • watchMode.changedFilesOnly: (Boolean) Only applies in watch mode. When true, only files which have changed since last run will be included in the stream passed to this task. (Optional, default false)

Deprecated Options

The following options should no longer be used and will be removed in future releases. They only exist for legacy compatibility.

  • always: (Boolean) Deprecated. For watch mode only. Serves the same purpose as watchMode.alwaysRun. This option is deprecated. Use watchMode.alwaysRun instead.
  • watchSourceDirectories: (Boolean) Deprecated. For watch mode only. Serves the same purpose as watchMode.includeSourceDirectories. This option is deprecated. Use watchMode.includeSourceDirectories instead.