Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "gulp-rev-all in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'gulp-rev-all' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

function doRevision() {
  return gulp
      .src([path.join(conf.paths.distPre, '**'), '!**/assets/**/*'])
      // Do not update references other than in index.html. Do not rev index.html itself.
      .pipe(revAll.revision(
          {dontRenameFile: ['index.html'], dontSearchFile: [/^(?!.*index\.html$).*$/]}))
      .pipe(gulp.dest(conf.paths.distRoot));
}
dontUpdateReference: ['.html'],
      includeFilesInManifest: ['.css', '.js', '.html', 'htm'],
      transformFilename: function (file, hash) {
        var ext = path.extname(file.path);

        // if(ext === '.html'){
        //     return path.basename(file.path, ext) + ext;
        // }

        return path.basename(file.path, ext) + '.' + hash.substr(0, 8) + ext;
      }
    };

    if (config['reversion']) {
      return gulp.src(['./tmp/**/*'])
        .pipe(RevAll.revision(RevOptions))
        .pipe(gulp.dest(paths.tmp.dir))
        .pipe(revDel({
          exclude: /(.html|.htm)$/
        }))
        .pipe(RevAll.manifestFile())
        .pipe(gulp.dest(paths.tmp.dir));
    } else {
      cb();
    }
  }
path.join(distPath, "webfonts", "*"),

    // Cachebust our JS files and the source maps for them.
    path.join(distPath, "js", "*.js"),
    path.join(distPath, "js", "*.map"),

    // Cachebust our vendored JS files and the source maps for them.
    path.join(distPath, "js", "vendor", "*.js"),
    path.join(distPath, "js", "vendor", "*.map"),

    // Cachebust our Image files.
    path.join(distPath, "images", "*"),
  ];

  return gulp.src(paths, { base: distPath })
    .pipe(manifest.revision({
      fileNameManifest: "manifest.json",
      includeFilesInManifest: [
        ".css",
        ".map",
        ".woff",
        ".woff2",
        ".svg",
        ".eot",
        ".ttf",
        ".otf",
        ".png",
        ".jpg",
        ".ico",
        ".js",
      ],
    }))
// if(ext === '.html'){
        //     return path.basename(file.path, ext) + ext;
        // }

        return path.basename(file.path, ext) + '.' + hash.substr(0, 8) + ext;
      }
    };

    if (config['reversion']) {
      return gulp.src(['./tmp/**/*'])
        .pipe(RevAll.revision(RevOptions))
        .pipe(gulp.dest(paths.tmp.dir))
        .pipe(revDel({
          exclude: /(.html|.htm)$/
        }))
        .pipe(RevAll.manifestFile())
        .pipe(gulp.dest(paths.tmp.dir));
    } else {
      cb();
    }
  }
gulp.task('dist-rev-assets', function() {
  const revAll = RevAll.revision({
    dontRenameFile: [
      '.json',
      'favicon.ico',
      /static\/addon\/*/,
      /static\/locales\/*/,
      /static\/images\/experiments\/[^]*\/social\/*/,
      '.html',
      '.rss',
      '.atom'
    ],
    dontUpdateReference: [
      /static\/addon\/*/,
      /static\/locales\/*/,
      /.*\.json/,
      /static\/images\/experiments\/[^]*\/social\/*/,
      'favicon.ico',
gulp.task("hash", done => {
    gulp
        .src("dist/**")
        .pipe(
            gulpIf('*.js',uglify())
        )
        .pipe(  
            gulpIf(isImage, imagemin()) 
        )
        .pipe(
            RevAll.revision({
                dontRenameFile: [/\.html$/]
            })
        )
        .pipe(revdel({
            exclude: function (file) {
                if (/\.html$/.test(file.name)) {
                    return true; //if you want to exclude the file from being deleted
                }
            }
        }))
        .pipe(gulp.dest("dist"))

    done();
});
gulp.task('revision:append', () => {
  return gulp.src(`${paths.dist.root}/**/*`)
    .pipe(RevAll.revision({dontRenameFile: [/^\/favicon.ico$/g, '.html']}))
    .pipe(gulp.dest(root.tmp))
})
gulp.task('assets', function () {
  let revAllOpts = {
    dontGlobal: ['.ico', 'fira.css', 'javascript-logo.png'],
    dontRenameFile: ['.ico', '.html', /fonts/],
    dontSearchFile: ['.js'],
    debug: false,
  }

  return gulp.src('./app/**/*')
  .pipe(RevAll.revision(revAllOpts))
  .pipe(gulp.dest('build'))
})
function bustCaches() {
	return src(['./dist/**'])
		.pipe(
			RevAll.revision({
				dontRenameFile: [/^\/favicon.ico$/g, '.html'],
				dontUpdateReference: [/^\/favicon.ico$/g, '.html'],
			}),
		)
		.pipe(dest('./dist'))
		.on('end', () => {
			gutil.beep();
			gutil.log(filesGenerated);
			gutil.log(thankYou);
		});
}
gulp.task('revision', () => {
  return gulp
  .src('public/**')
  .pipe(RevAll.revision(revisionOpts))
  .pipe(gulp.dest('tmp'))
})

Is your System Free of Underlying Vulnerabilities?
Find Out Now