How do I replace the filenames listed in index.html with the output of gulp-rev?

后端 未结 5 1525
一生所求
一生所求 2021-02-04 03:13

I\'m using gulp-rev to build static files that I can set to never expire. I\'d like to replace all references to the generated files in index.html to these renamed files, but I

5条回答
  •  逝去的感伤
    2021-02-04 03:29

    This helped me gulp-html-replace.

     
         
         
         
    
        var gulp = require('gulp');
        var htmlreplace = require('gulp-html-replace');
    
        gulp.task('default', function() {
          gulp.src('index.html')
            .pipe(htmlreplace({
                'css': 'styles.min.css',
                'js': 'js/bundle.min.js'
            }))
            .pipe(gulp.dest('build/'));
        });
    

提交回复
热议问题