All Projects → sindresorhus → gulp-revert-path

sindresorhus / gulp-revert-path

Licence: MIT license
Revert the previous `file.path` change

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to gulp-revert-path

gulp-upload-qcloud
腾讯云 cos 静态资源上传 gulp 插件
Stars: ✭ 18 (+0%)
Mutual labels:  gulp-plugin
gulp-html
Gulp plugin for HTML validation, using the official Nu Html Checker (v.Nu)
Stars: ✭ 70 (+288.89%)
Mutual labels:  gulp-plugin
gulp-strip-json-comments
Strip comments from JSON. Lets you use comments in your JSON files!
Stars: ✭ 25 (+38.89%)
Mutual labels:  gulp-plugin
gulp-xo
Validate files with XO
Stars: ✭ 37 (+105.56%)
Mutual labels:  gulp-plugin
gulp-cleanhtml
remove unneeded whitespaces, line-breaks, comments, etc from the HTML.
Stars: ✭ 19 (+5.56%)
Mutual labels:  gulp-plugin
gulp-rework
Preprocess CSS with Rework
Stars: ✭ 30 (+66.67%)
Mutual labels:  gulp-plugin
Gulp Size
Display the size of your project
Stars: ✭ 225 (+1150%)
Mutual labels:  gulp-plugin
gulp-jsvalidate
Validate JavaScript code and report possible syntax errors
Stars: ✭ 23 (+27.78%)
Mutual labels:  gulp-plugin
gulp-sitemap
Generate a search engine friendly sitemap.xml using a Gulp stream
Stars: ✭ 60 (+233.33%)
Mutual labels:  gulp-plugin
gulp-qunit
Run QUnit unit tests in a headless PhantomJS instance.
Stars: ✭ 24 (+33.33%)
Mutual labels:  gulp-plugin
gulp-sort
Sort files in stream by path or any custom sort comparator
Stars: ✭ 22 (+22.22%)
Mutual labels:  gulp-plugin
gulp-myth
[DEPRECATED] Myth - Postprocessor that polyfills CSS
Stars: ✭ 39 (+116.67%)
Mutual labels:  gulp-plugin
gulp-merge-json
A gulp plugin to merge JSON & JSON5 files into one file
Stars: ✭ 35 (+94.44%)
Mutual labels:  gulp-plugin
gulp-spsync-creds
Gulp plugin for synchronizing local files with a SharePoint library via user credentials
Stars: ✭ 12 (-33.33%)
Mutual labels:  gulp-plugin
gulp-esbuild
gulp plugin for esbuild bundler
Stars: ✭ 39 (+116.67%)
Mutual labels:  gulp-plugin
Gulp Strip Debug
Strip console, alert, and debugger statements from JavaScript code
Stars: ✭ 242 (+1244.44%)
Mutual labels:  gulp-plugin
gulp-es6-transpiler
[DEPRECATED] Transpile ES2015 to ES5
Stars: ✭ 47 (+161.11%)
Mutual labels:  gulp-plugin
gulp-recess
[DEPRECATED] Lint CSS and LESS with RECESS
Stars: ✭ 42 (+133.33%)
Mutual labels:  gulp-plugin
gulp-px2rem
This is a gulp plugin for node-px2rem.
Stars: ✭ 19 (+5.56%)
Mutual labels:  gulp-plugin
gulp-ava
Run AVA tests
Stars: ✭ 56 (+211.11%)
Mutual labels:  gulp-plugin

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

const gulp = require('gulp');
const babel = require('gulp-babel');
const revertPath = require('gulp-revert-path');
const rename = require('gulp-rename');

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

exports.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(reversions?)

reversions

Type: number
Default: 1

Number of times to revert the path.

Related

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].