@@ -11,6 +11,7 @@ const ospath = require('path')
11
11
const path = ospath . posix
12
12
const postcss = require ( 'gulp-postcss' )
13
13
const postcssCalc = require ( 'postcss-calc' )
14
+ const gulpif = require ( 'gulp-if' )
14
15
const postcssAdvancedVars = require ( 'postcss-advanced-variables' )
15
16
const postcssImport = require ( 'postcss-import' )
16
17
const tailwindcss = require ( 'tailwindcss' )
@@ -74,34 +75,34 @@ module.exports = (src, dest, preview) => () => {
74
75
. pipe ( uglify ( { output : { comments : / ^ ! / } } ) )
75
76
// NOTE concat already uses stat from newest combined file
76
77
. pipe ( concat ( 'js/site.js' ) )
77
- . pipe ( hash ( { template : '<%= name %>-<%= hash %><%= ext %>' } ) )
78
+ . pipe ( gulpif ( ! preview , hash ( { template : '<%= name %>-<%= hash %><%= ext %>' } ) ) )
78
79
. pipe ( vfs . dest ( dest ) )
79
- . pipe ( hash . manifest ( 'assets-manifest.json' , { append : true } ) )
80
+ . pipe ( gulpif ( ! preview , hash . manifest ( 'assets-manifest.json' , { append : true } ) ) )
80
81
. pipe ( vfs . dest ( dest ) ) ,
81
82
vfs
82
83
. src ( 'js/vendor/*([^.])?(.bundle).js' , { ...opts , read : false } )
83
84
. pipe ( bundle ( opts ) )
84
85
. pipe ( uglify ( { output : { comments : / ^ ! / } } ) )
85
- . pipe ( hash ( { template : '<%= name %>-<%= hash %><%= ext %>' } ) )
86
+ . pipe ( gulpif ( ! preview , hash ( { template : '<%= name %>-<%= hash %><%= ext %>' } ) ) )
86
87
. pipe ( vfs . dest ( dest ) )
87
- . pipe ( hash . manifest ( 'assets-manifest.json' , { append : true } ) )
88
+ . pipe ( gulpif ( ! preview , hash . manifest ( 'assets-manifest.json' , { append : true } ) ) )
88
89
. pipe ( vfs . dest ( dest ) ) ,
89
90
vfs
90
91
. src ( 'js/vendor/*.min.js' , opts )
91
92
. pipe ( map ( ( file , enc , next ) => next ( null , Object . assign ( file , { extname : '' } , { extname : '.js' } ) ) ) )
92
- . pipe ( hash ( { template : '<%= name %>-<%= hash %><%= ext %>' } ) )
93
+ . pipe ( gulpif ( ! preview , hash ( { template : '<%= name %>-<%= hash %><%= ext %>' } ) ) )
93
94
. pipe ( vfs . dest ( dest ) )
94
- . pipe ( hash . manifest ( 'assets-manifest.json' , { append : true } ) )
95
+ . pipe ( gulpif ( ! preview , hash . manifest ( 'assets-manifest.json' , { append : true } ) ) )
95
96
. pipe ( vfs . dest ( dest ) ) ,
96
97
// NOTE use the next line to bundle a JavaScript library that cannot be browserified, like jQuery
97
98
//vfs.src(require.resolve('<package-name-or-require-path>'), opts).pipe(concat('js/vendor/<library-name>.js')),
98
99
vfs . src ( './tailwind.config.js' ) . pipe ( concat ( 'js/tailwind.config.js' ) ) ,
99
100
vfs
100
101
. src ( [ 'css/site.css' , 'css/vendor/*.css' ] , { ...opts , sourcemaps } )
101
102
. pipe ( postcss ( ( file ) => ( { plugins : postcssPlugins , options : { file } } ) ) )
102
- . pipe ( hash ( { template : '<%= name %>-<%= hash %><%= ext %>' } ) )
103
+ . pipe ( gulpif ( ! preview , hash ( { template : '<%= name %>-<%= hash %><%= ext %>' } ) ) )
103
104
. pipe ( vfs . dest ( dest ) )
104
- . pipe ( hash . manifest ( 'assets-manifest.json' , { append : true } ) )
105
+ . pipe ( gulpif ( ! preview , hash . manifest ( 'assets-manifest.json' , { append : true } ) ) )
105
106
. pipe ( vfs . dest ( dest ) ) ,
106
107
vfs . src ( 'font/*.{ttf,woff*(2)}' , opts ) ,
107
108
vfs . src ( 'img/**/*.{gif,ico,jpg,png,svg}' , opts ) . pipe (
0 commit comments