gulp-revert-path

3.0.0 • Public • Published

gulp-revert-path

Revert the previous file.path change

Many plugins change the file.path somehow. Most commonly the file extension. For example gulp-babel changes .jsx extensions to .js since it compiles JSX. Sometimes that's undesirable though. This plugin makes it easy to revert the path change.

Install

npm install --save-dev gulp-revert-path

Usage

import gulp from 'gulp';
import babel from 'gulp-babel';
import revertPath from 'gulp-revert-path';
import rename from 'gulp-rename';

export default () => (
	gulp.src('src/app.jsx')
		.pipe(babel())       // file.path => src/app.js
		.pipe(revertPath())  // file.path => src/app.jsx
		.pipe(gulp.dest('dist'))
);

export const es2015 = () => (
	gulp.src('src/app.txt')
		.pipe(rename('src/app.jsx'))  // file.path => src/app.jsx
		.pipe(babel())                // file.path => src/app.js
		.pipe(revertPath(2))          // file.path => src/app.txt
		.pipe(gulp.dest('dist'))
);

API

revertPath(reversionCount?)

reversionCount

Type: number
Default: 1

The number of times to revert the path.

Dependencies (1)

Dev Dependencies (4)

Package Sidebar

Install

npm i gulp-revert-path

Weekly Downloads

2,765

Version

3.0.0

License

MIT

Unpacked Size

3.74 kB

Total Files

4

Last publish

Collaborators

  • sindresorhus