javascript - gulp/minify: index.html gets cryptic extension in file name, how to take advantage? -
i minifying index.html file gulp (note: took on project, build system has been done former dev).
it works fine, gulp task generates html file has cryptic extension it, like:
index-bd2c7f58f0.html
i understand must have it's advantage, can't grasp what...:) because disadvantage is:
- the node server needs presence of
index.html
file allow'/'
route work. - thus far, either have copy file on every build or create link needs updated on every build
what missing? should instruct gulp create plain index.html
file, or best practices here?
also, of various plugin calls responsible attaching extension file name?
edit: seems gulp-rev , revreplace calls
here gulp task using:
gulp.task('html', ['styles', 'scripts'], function () { var client = buildhtml('./client/index.html', './dist/public'); return merge(client); }); function buildhtml(index, distfolder) { var lazypipe = require('lazypipe'); var savehtml = lazypipe() .pipe($.htmlmin, { removecomments: true, removeoptionaltags: true }) .pipe(gulp.dest, distfolder); return gulp.src(index) .pipe($.useref()) .pipe($.rev()) .pipe($.revreplace({replaceinextensions: ['.js', '.css', '.html', '.ejs']})) .pipe($.if('*.html', savehtml())); }
one advantage i'm familiar when it's used assets, when recompile asset , create new fingerprint file, request won't return cached response because it's different file. problem, shouldn't adding has index, think it's pretty unorthodox
Comments
Post a Comment