Socket
Socket
Sign inDemoInstall

gulp-rename

Package Overview
Dependencies
Maintainers
5
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-rename

Rename files


Version published
Weekly downloads
625K
increased by6.52%
Maintainers
5
Weekly downloads
 
Created

What is gulp-rename?

The gulp-rename package is a plugin for Gulp that allows you to rename files easily. It provides a simple way to change the name, extension, or path of files in your Gulp build process.

What are gulp-rename's main functionalities?

Rename a file

This feature allows you to rename a file. In this example, 'src/file.txt' is renamed to 'renamed-file.txt' and saved in the 'dist' directory.

const gulp = require('gulp');
const rename = require('gulp-rename');

gulp.task('rename', function() {
  return gulp.src('src/file.txt')
    .pipe(rename('renamed-file.txt'))
    .pipe(gulp.dest('dist'));
});

Change file extension

This feature allows you to change the file extension. In this example, 'src/file.txt' is renamed to 'file.md' and saved in the 'dist' directory.

const gulp = require('gulp');
const rename = require('gulp-rename');

gulp.task('change-extension', function() {
  return gulp.src('src/file.txt')
    .pipe(rename({ extname: '.md' }))
    .pipe(gulp.dest('dist'));
});

Rename with a function

This feature allows you to use a function to rename files. In this example, 'src/file.txt' is renamed to 'file-renamed.md' and saved in the 'dist' directory.

const gulp = require('gulp');
const rename = require('gulp-rename');

gulp.task('rename-function', function() {
  return gulp.src('src/file.txt')
    .pipe(rename(function (path) {
      path.basename += '-renamed';
      path.extname = '.md';
    }))
    .pipe(gulp.dest('dist'));
});

Other packages similar to gulp-rename

Keywords

FAQs

Package last updated on 04 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc