@@ -30,7 +30,8 @@ module.exports = (src, dest, preview) => () => {
30
30
. reduce ( ( accum , { file : depPath , type } ) => ( type === 'dependency' ? accum . concat ( depPath ) : accum ) , [ ] )
31
31
. map ( ( importedPath ) => fs . stat ( importedPath ) . then ( ( { mtime } ) => mtime ) )
32
32
) . then ( ( mtimes ) => {
33
- const newestMtime = mtimes . reduce ( ( max , curr ) => ( ! max || curr > max ? curr : max ) )
33
+ const newestMtime = mtimes . reduce ( ( max , curr ) =>
34
+ ( ! max || curr > max ? curr : max ) , 0 )
34
35
if ( newestMtime > file . stat . mtime ) file . stat . mtimeMs = + ( file . stat . mtime = newestMtime )
35
36
} ) ,
36
37
postcssUrl ( [
@@ -60,7 +61,7 @@ module.exports = (src, dest, preview) => () => {
60
61
// NOTE concat already uses stat from newest combined file
61
62
. pipe ( concat ( 'js/site.js' ) ) ,
62
63
vfs
63
- . src ( 'js/vendor/* .js' , { ...opts , read : false } )
64
+ . src ( 'js/vendor/+([^.])?(.bundle) .js' , { ...opts , read : false } )
64
65
. pipe (
65
66
// see https://gulpjs.org/recipes/browserify-multiple-destination.html
66
67
map ( ( file , enc , next ) => {
@@ -74,7 +75,7 @@ module.exports = (src, dest, preview) => () => {
74
75
} )
75
76
. bundle ( ( bundleError , bundleBuffer ) =>
76
77
Promise . all ( mtimePromises ) . then ( ( mtimes ) => {
77
- const newestMtime = mtimes . reduce ( ( max , curr ) => ( ! max || curr > max ? curr : max ) )
78
+ const newestMtime = mtimes . reduce ( ( max , curr ) => ( ! max || curr > max ? curr : max ) , 0 )
78
79
if ( newestMtime > file . stat . mtime ) file . stat . mtimeMs = + ( file . stat . mtime = newestMtime )
79
80
if ( bundleBuffer !== undefined ) file . contents = bundleBuffer
80
81
file . path = file . path . slice ( 0 , file . path . length - 10 ) + '.js'
@@ -91,6 +92,9 @@ module.exports = (src, dest, preview) => () => {
91
92
)
92
93
. pipe ( buffer ( ) )
93
94
. pipe ( uglify ( { output : { comments : / ^ ! / } } ) ) ,
95
+ vfs
96
+ . src ( 'js/vendor/*.min.js' , opts )
97
+ . pipe ( map ( ( file , enc , next ) => next ( null , Object . assign ( file , { extname : '' } , { extname : '.js' } ) ) ) ) ,
94
98
vfs . src ( require . resolve ( 'jquery/dist/jquery.min.js' ) , opts ) . pipe ( concat ( 'js/vendor/jquery.js' ) ) ,
95
99
vfs
96
100
. src ( [ 'css/site.css' , 'css/vendor/docsearch.css' ] , { ...opts , sourcemaps } )
0 commit comments