1.0.0 • Published 4 years ago

gulp-webpack-yawp v1.0.0

Weekly downloads
161
License
MIT
Repository
github
Last release
4 years ago

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:

propertytypedefaultvaluesdescription
webpackobject----Webpack instance
wpConfigobject----Webpack configuration
logModestring'silent''silent', 'stats', 'verbose'Webpack log mode
statsOptionsobjectsee below--Options for log mode 'stats'
verbosebooleanfalse--Plugin verbose mode
watchbooleanfalse--Use webpack in watch mode
watchOptionsobjectsee 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