Can gulp be replaced without renaming?

  node.js, question


Replace “css/index.css” with “css/index.min.css” in htm page;

The current process is,

  1. concat;

  2. autoprefixer;

  3. clean-css;

  4. Json;

  5. RevCollector replaces the page according to the result of 4 and outputs it;

The result of the process is:

The process takes effect, but index.css is replaced by index-xxxx.css, so it is obvious that each file name generated is different. can it be changed into indec.min.css or index.min.css? 1213 like this? What plug-in should I use?

This is how I play:

var gulp = require('gulp');
 var rev = require('gulp-rev');
 var through = require('through2');
 var modify = require('modify-filename');
 gulp.task('default', function() {
 return gulp.src('*.css')
 .pipe(through.obj(function(file, enc, cb) {
 // write the NEW path
 file.path = modify(file.revOrigPath, function(name, ext) {
 Return name plus'. min' plus ext plus'?'  Add file.revHash;
 // send it back to stream
 cb(null, file);

Originaltest.css, after processing, will becomedist/test.min.css? 8ba9b68ade

I don’t know if it is what you want, and I also renamed the file. Not after the urlquery. In fact, if you understandgulp-revWhat are you doing? You can understand why she can only change the file name. To put it bluntly, this stage has not yet been touchedhtml, so god knows the follow-uphtmlHow do you refer to a resource, let alone modify it?htmlInside’s quotation, after addqueryHere we go.