Skip to content
This repository was archived by the owner on Mar 17, 2023. It is now read-only.

Commit e424808

Browse files
committed
Disable option for [email protected]
1 parent 4dcac71 commit e424808

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ rules: [{
4141
{
4242
loader: 'image-webpack-loader',
4343
options: {
44-
bypassOnDebug: true,
44+
bypassOnDebug: true, // [email protected]
45+
disable: true, // [email protected] and newer
4546
},
4647
},
4748
],
@@ -110,6 +111,13 @@ Default: `false`
110111

111112
Using this, no processing is done when webpack 'debug' mode is used and the loader acts as a regular file-loader. Use this to speed up initial and, to a lesser extent, subsequent compilations while developing or using webpack-dev-server. Normal builds are processed normally, outputting optimized files.
112113

114+
#### disable
115+
116+
Type: `boolean`
117+
Default `false`
118+
119+
Same functionality as **bypassOnDebug** option, but doesn't depend on webpack debug mode, which was deprecated in 2.x. Basically you want to use this option if you're running [email protected] or newer.
120+
113121
For optimizer options, an up-to-date and exhaustive list is available on each optimizer repository:
114122

115123
- [mozjpeg](https://github.com/imagemin/imagemin-mozjpeg#options)

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module.exports = function(content) {
2929

3030
var options = {
3131
bypassOnDebug: config.bypassOnDebug || false,
32+
disable: config.disable || false,
3233
// default optimizers
3334
gifsicle: config.gifsicle || {},
3435
mozjpeg: config.mozjpeg || {},
@@ -55,7 +56,7 @@ module.exports = function(content) {
5556
var callback = this.async(),
5657
called = false;
5758

58-
if (this.debug === true && options.bypassOnDebug === true) {
59+
if ((this.debug === true && options.bypassOnDebug === true) || options.disable === true) {
5960
// Bypass processing while on watch mode
6061
return callback(null, content);
6162
} else {

0 commit comments

Comments
 (0)