@@ -53,36 +53,39 @@ const getEngine = memoize(function () {
5353 return engine ? engine ( ) : ( ( ) => { } ) ;
5454} ) ;
5555
56+ function html ( options ) {
57+ const build = options && ! ! options . build ;
5658
57- function html ( ) {
58- return gulp . src ( getGlobPaths ( ) )
59- . pipe ( taskStart ( ) )
59+ return function html ( ) {
60+ return gulp . src ( getGlobPaths ( ) )
61+ . pipe ( taskStart ( ) )
6062
61- // Faster incremental builds, skip files which didn't changed or their dependencies didn't changed
62- . pipe ( gulpif ( ! ! getConfig . getTaskConfig ( 'html' , 'dependents' ) , cached ( 'html' ) ) )
63- . pipe ( gulpif ( ! ! getConfig . getTaskConfig ( 'html' , 'dependents' ) , dependents ( getConfig . getTaskConfig ( 'dependents' ) ) ) )
63+ // Faster incremental builds, skip files which didn't changed or their dependencies didn't changed
64+ . pipe ( gulpif ( ! ! getConfig . getTaskConfig ( 'html' , 'dependents' ) , cached ( 'html' ) ) )
65+ . pipe ( gulpif ( ! ! getConfig . getTaskConfig ( 'html' , 'dependents' ) , dependents ( getConfig . getTaskConfig ( 'dependents' ) ) ) )
6466
65- // Prevent file from being rendered if it's in the ignore list
66- . pipe ( ignore . exclude ( getGlobIgnorePaths ( ) , { } ) )
67+ // Prevent file from being rendered if it's in the ignore list
68+ . pipe ( ignore . exclude ( getGlobIgnorePaths ( ) , { } ) )
6769
68- // Preprocess using TWIG
69- . pipe ( gulpif ( ! ! getConfig . getTaskConfig ( 'html' , 'engine' ) , data ( getData ) ) )
70- . pipe ( gulpif ( ! ! getConfig . getTaskConfig ( 'html' , 'engine' ) , getEngine ( ) ) )
70+ // Preprocess using TWIG
71+ . pipe ( gulpif ( ! ! getConfig . getTaskConfig ( 'html' , 'engine' ) , data ( getData ( { build : build } ) ) ) )
72+ . pipe ( gulpif ( ! ! getConfig . getTaskConfig ( 'html' , 'engine' ) , getEngine ( ) ) )
7173
72- // Minify
73- . pipe ( gulpif ( ! ! getConfig . getTaskConfig ( 'html' , 'htmlmin' ) , htmlmin ( getConfig . getTaskConfig ( 'html' , 'htmlmin' ) ) ) )
74+ // Minify
75+ . pipe ( gulpif ( ! ! getConfig . getTaskConfig ( 'html' , 'htmlmin' ) , htmlmin ( getConfig . getTaskConfig ( 'html' , 'htmlmin' ) ) ) )
7476
75- . pipe ( taskBeforeDest ( ) )
76- . pipe ( gulp . dest ( getPaths . getDestPath ( 'html' ) ) )
77+ . pipe ( taskBeforeDest ( ) )
78+ . pipe ( gulp . dest ( getPaths . getDestPath ( 'html' ) ) )
7779
78- // Reload on change
79- . pipe ( taskEnd ( ) ) ;
80+ // Reload on change
81+ . pipe ( taskEnd ( ) ) ;
82+ } ;
8083}
8184
8285function htmlWatch ( ) {
83- return taskWatch ( getWatchGlobPaths ( ) , html ) ;
86+ return taskWatch ( getWatchGlobPaths ( ) , html ( { build : false } ) ) ;
8487}
8588
8689
87- exports . build = html ;
90+ exports . build = html ( { build : true } ) ;
8891exports . watch = htmlWatch ;
0 commit comments