gulp-webpack-yawp

1.0.0 • Public • Published

gulp-webpack-yawp

Yet another Webpack plugin (for Gulp)

Motivation

After some time using webpack-stream I hit a limitation with it: The vinyl object piped out is not the same one as the one piped in.

I need some custom properties on the vinyl objects for my gulp setup, so this was a show stopper. The custom properties were not available after the files were piped into the plugin.

I decided to fix this problem and PR, but as I read and understood the code I decided to change so much stuff that it was beyond a PR.

webpack-stream creates some basic webpack configuration that applies. gulp-webpack-yawp does not.

Getting Started

Prerequisites

This plugin only works with Webpack 4.

Installing

npm i --save-dev gulp-webpack-yawp

Usage

Example gulp task:

const
  { src, dest } = require( 'gulp' ),
  webpack = require( 'gulp-webpack-yawp' );

exports.default = function compileJs() {
  return src( 'src/js/*.js' )
    .pipe( webpack())
    .pipe( dest( 'output/' )
}

Plugin options

The plugin accepts a configuration object with the following properties:

property type default values description
webpack object -- -- Webpack instance
wpConfig object -- -- Webpack configuration
logMode string 'silent' 'silent', 'stats', 'verbose' Webpack log mode
statsOptions object [see below] -- Options for log mode 'stats'
verbose boolean false -- Plugin verbose mode
watch boolean false -- Use webpack in watch mode
watchOptions object [see below] -- Options for watch mode
webpack

A webpack instance. If passed it will be cached for subsequent usage.

wpConfig

A webpack configuration object.

logMode

Log mode for webpack to use. Choose between 'silent', 'verbose' or 'stats'.

If 'stats' is passed, an additional option can be used to specify what's going to get logged.

statsOptions

A stats options object for webpack to use.

Defaults to:

{
  builtAt: false,
  chunks: false,
  children: false,
  hash: false,
  modules: false,
  performance: true,
  warnings: true,
}
verbose

Plugin verbosity.

watch

Initiate webpack in watch mode. If true, an additional watchOptions object can be passed.

watchOptions

A watch options object.

Defaults to:

{
  builtAt: false,
  chunks: false,
  colors: TERMINAL_HAS_COLOR,
  children: false,
  hash: false,
  modules: false,
  performance: true,
  warnings: true,
}

Compatibility with other plugins

This plugin supports:

Running the tests

npm run test

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Contributing

Issues and PR are welcomed.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

Package Sidebar

Install

npm i gulp-webpack-yawp

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

20 kB

Total Files

10

Last publish

Collaborators

  • crisisinaptica