skyrpex / gulp-less-watcher

(Not Maintained) Watches Less files (and imports) using an endless streaming interface (and generates sourcemaps)
MIT License
2 stars 2 forks source link

debounce and notify #7

Closed sprynm closed 6 years ago

sprynm commented 8 years ago

I've had fair success triggering less-watcher in my builds based on a --watch flag:

.pipe( $.if( watch, $.lessWatcher( LESSConfig ) ) )

It can only watch one file at a time but I understand you will be looking at that here: #6

However, I'd like to solve two annoying things:

  1. trigger a notice when the file is built:

    function() { notifier.notify( { message: fileName + " Rebuilt" } ) }

  2. debounce the file changes. If a file (or files) is saved within 1-2 seconds, it should only trigger one rebuild.

Any thoughts on how I can do either now?

Here was my attempt which failed silently on both accounts:

.pipe( $.if( watch, $.lessWatcher( 
    LESSConfig,
    {debounceDelay: 2000},
    function() {
        notifier.notify({
            message: "Portal files rebuilt"
        })
    }
) ) ) 

(Gulp 4)