gulp-revert-path
Advanced tools
+4
-3
@@ -10,8 +10,9 @@ 'use strict'; | ||
| var highestIndex = history.length - 1; | ||
| var localReversions = reversions; | ||
| if (reversions > highestIndex) { | ||
| reversions = highestIndex; | ||
| if (localReversions > highestIndex) { | ||
| localReversions = highestIndex; | ||
| } | ||
| history.splice(-reversions, reversions); | ||
| history.splice(-localReversions, localReversions); | ||
| file.path = history[history.length - 1]; | ||
@@ -18,0 +19,0 @@ |
+4
-3
| { | ||
| "name": "gulp-revert-path", | ||
| "version": "1.2.0", | ||
| "version": "1.2.1", | ||
| "description": "Revert the previous `file.path` change", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
| "scripts": { | ||
| "test": "mocha" | ||
| "test": "xo && mocha" | ||
| }, | ||
@@ -38,4 +38,5 @@ "files": [ | ||
| "gulp-util": "^3.0.4", | ||
| "mocha": "*" | ||
| "mocha": "*", | ||
| "xo": "*" | ||
| } | ||
| } |
+15
-15
@@ -18,21 +18,21 @@ # gulp-revert-path [](https://travis-ci.org/sindresorhus/gulp-revert-path) | ||
| ```js | ||
| var gulp = require('gulp'); | ||
| var babel = require('gulp-babel'); | ||
| var revertPath = require('gulp-revert-path'); | ||
| var rename = require('gulp-rename'); | ||
| const gulp = require('gulp'); | ||
| const babel = require('gulp-babel'); | ||
| const revertPath = require('gulp-revert-path'); | ||
| const rename = require('gulp-rename'); | ||
| gulp.task('default', function () { | ||
| return gulp.src('src/app.jsx') | ||
| gulp.task('default', () => | ||
| gulp.src('src/app.jsx') | ||
| .pipe(babel()) // file.path => src/app.js | ||
| .pipe(revertPath()) // file.path => src/app.jsx | ||
| .pipe(gulp.dest('dist')); | ||
| }); | ||
| .pipe(gulp.dest('dist')) | ||
| ); | ||
| gulp.task('es2015', function () { | ||
| return gulp.src('src/app.txt') | ||
| gulp.task('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')); | ||
| }); | ||
| .pipe(gulp.dest('dist')) | ||
| ); | ||
| ``` | ||
@@ -43,7 +43,7 @@ | ||
| ### revertPath(reversions) | ||
| ### revertPath([reversions]) | ||
| #### reversions | ||
| Type: `number` | ||
| Type: `number`<br> | ||
| Default: `1` | ||
@@ -61,2 +61,2 @@ | ||
| MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
| MIT © [Sindre Sorhus](https://sindresorhus.com) |
3781
1.5%16
6.67%3
50%