@@ -6,39 +6,39 @@ const applySourceMap = require('vinyl-sourcemaps-apply');
6
6
const autoprefixer = require ( 'autoprefixer' ) ;
7
7
const postcss = require ( 'postcss' ) ;
8
8
9
- module . exports = opts => {
10
- return through . obj ( ( file , enc , cb ) => {
9
+ module . exports = options => {
10
+ return through . obj ( ( file , encoding , callback ) => {
11
11
if ( file . isNull ( ) ) {
12
- cb ( null , file ) ;
12
+ callback ( null , file ) ;
13
13
return ;
14
14
}
15
15
16
16
if ( file . isStream ( ) ) {
17
- cb ( new PluginError ( 'gulp-autoprefixer' , 'Streaming not supported' ) ) ;
17
+ callback ( new PluginError ( 'gulp-autoprefixer' , 'Streaming not supported' ) ) ;
18
18
return ;
19
19
}
20
20
21
- postcss ( autoprefixer ( opts ) ) . process ( file . contents . toString ( ) , {
21
+ postcss ( autoprefixer ( options ) ) . process ( file . contents . toString ( ) , {
22
22
map : file . sourceMap ? { annotation : false } : false ,
23
23
from : file . path ,
24
24
to : file . path
25
- } ) . then ( res => {
26
- file . contents = Buffer . from ( res . css ) ;
25
+ } ) . then ( result => {
26
+ file . contents = Buffer . from ( result . css ) ;
27
27
28
- if ( res . map && file . sourceMap ) {
29
- const map = res . map . toJSON ( ) ;
28
+ if ( result . map && file . sourceMap ) {
29
+ const map = result . map . toJSON ( ) ;
30
30
map . file = file . relative ;
31
31
map . sources = map . sources . map ( ( ) => file . relative ) ;
32
32
applySourceMap ( file , map ) ;
33
33
}
34
34
35
- const warnings = res . warnings ( ) ;
35
+ const warnings = result . warnings ( ) ;
36
36
37
37
if ( warnings . length > 0 ) {
38
38
fancyLog ( 'gulp-autoprefixer:' , '\n ' + warnings . join ( '\n ' ) ) ;
39
39
}
40
40
41
- setImmediate ( cb , null , file ) ;
41
+ setImmediate ( callback , null , file ) ;
42
42
} ) . catch ( error => {
43
43
const cssError = error . name === 'CssSyntaxError' ;
44
44
@@ -47,7 +47,7 @@ module.exports = opts => {
47
47
}
48
48
49
49
// Prevent stream unhandled exception from being suppressed by Promise
50
- setImmediate ( cb , new PluginError ( 'gulp-autoprefixer' , error , {
50
+ setImmediate ( callback , new PluginError ( 'gulp-autoprefixer' , error , {
51
51
fileName : file . path ,
52
52
showStack : ! cssError
53
53
} ) ) ;
0 commit comments