gulp-bundle-assets icon indicating copy to clipboard operation
gulp-bundle-assets copied to clipboard

Add Gulp-Remember Into Bundle Flow

Open smschrader opened this issue 10 years ago • 3 comments

Adding the ability to configure/enable gulp-remember will help make large bundles faster during development.

smschrader avatar Mar 19 '15 14:03 smschrader

Adding gulp-remember is already possible to the main bundle task, e.g.:

gulp.task('lessMain', function() {  
    return gulp.src(projectPaths.cssMainConfig)        
        .pipe(cache('less'))
        .pipe(remember('less'))
        .pipe(bundle())        
        .pipe(bundle.results({
            fileName: 'main.result',
            dest: projectPaths.cssResults,
            pathPrefix: '<%=request.getContextPath()%>/dist/styles/'
        }))        
        .pipe(gulp.dest(projectPaths.cssDist));
});

However, an enhancement needs to be added to gbundle.watch to allow actions to run on change. I'm thinking of a config option like so:

gbundle.watch({
    configPath: path.join(__dirname, 'bundle.config.js'),
    results: {
      dest: __dirname,
      pathPrefix: '/public/',
      fileName: 'manifest'
    },
    dest: path.join(__dirname, 'public'),
    onChange: function (event) { // custom on change event handler
        if (event.type === 'deleted') {
            delete cache.caches['scripts'][event.path];
            remember.forget('scripts', event.path);
        }
    }
});

How does that sound?

chmontgomery avatar Mar 19 '15 15:03 chmontgomery

@chmontgomery I like that, simple enough!

smschrader avatar Mar 19 '15 15:03 smschrader

That looks like a great addition to the API. Some of my bundles/copy tasks are pretty hefty

timelf123 avatar Jun 26 '15 04:06 timelf123