Questions tagged [gulp-rename]

gulp-rename is a gulp plugin to rename files easily.

gulp-rename is a gulp plugin for easy file renaming.

Rename using string example:

var rename = require("gulp-rename");

gulp.src("./app/main/text/hello-world.txt")
  .pipe(rename("main/text/ciao/goodbye-world.md"))
  .pipe(gulp.dest("./build")); // ./build/main/text/ciao/goodbye-world.md

Rename using function:

var rename = require("gulp-rename");

gulp.src("./app/main/text/hello-world.txt")
  .pipe(rename(function (path) {
    path.dirname += "/ciao";
    path.basename += "-guys";
    path.extname = ".md"
  }))
  .pipe(gulp.dest("./build")); // ./build/main/text/ciao/hello-world-guys.md
54 questions
6
votes
2 answers

How do I create a Gulp Task to do minification and source maps to a .min file properly

I'm trying to create a gulp task to compress and create a source map at the same time. The compression and source map creation works, but I can't seem how to figure out how to get the output names right when using the gulp-rename plugin. To…
Rick Strahl
  • 17,302
  • 14
  • 89
  • 134
6
votes
1 answer

Rename file based on regex in Gulp

Say I have a LESS CSS directory structure like this: less/ core/ _main.less header.less body.less footer.less contact/ _main.less form.less details.less I want to write a Gulp task…
gitaarik
  • 42,736
  • 12
  • 98
  • 105
5
votes
1 answer

batch resizing in gulp

I need to make versions of images in different resolutions. However, the output of my gulp code is a mess - some files are missing, some pictures are saved under different filenames. I know it has something to do with async execution, but I'm not…
Mikhail Vasin
  • 2,421
  • 1
  • 24
  • 31
4
votes
1 answer

Gulp Rename illegal operation

My gulp file looks like: function aureliaJsonPath(name) { return `./aurelia_project/aurelia.${name}.json`; } gulp.task('use-login-au-json', () => { return gulp.src(aureliaJsonPath('login')) .pipe(rename('aurelia.json')) …
Callum Linington
  • 14,213
  • 12
  • 75
  • 154
4
votes
2 answers

gulp rename multiple files

I have a gulp script to manipulate a master html file and rename it into several name based on an array. here's the script. gulp.task('default', function () { var data = ['name1','name2']; for(var name in data){ …
Chito Cheng
  • 540
  • 2
  • 9
  • 25
3
votes
1 answer

Flattening parent directory but not subdirectories using gulp

I organized my code so that it has some keywords on the folder names such as _DIRECTIVE. My intention was to write a gulp task that recognize the folder naming pattern, using gulp.src("**/*_DIRECTIVE/**/*"). I want to make a copy of all folders (and…
Khaled Awad
  • 1,644
  • 11
  • 24
2
votes
2 answers

remove body content of index.html using gulp

I can able to rename file name from index. using following configuration Gulp.js var rename = require("gulp-rename"); gulp.task('modify-html', function () { gulp.src('reports/index.html') .pipe(rename('/app.html')) …
Jenson Raby
  • 769
  • 2
  • 6
  • 26
2
votes
1 answer

gulp-rev not working with gulp-watch

Below is my code My main issue I have to watch changes of js and css and also based on that generate min file with proper version also my output directory is same that is also one case. 'use strict'; var gulp = require('gulp'); var rename =…
Nikunj Chotaliya
  • 802
  • 8
  • 19
2
votes
1 answer

Triggering separate gulp tasks for subfolders in different paths

I am using Gulp to store multiple SVG files into SVG storages which are later reused in order to maximize performance. However, I am now using a rather interesting folder structure where the paths contain interchangeable fixed and dynamic parts. Let…
user188654
2
votes
2 answers

Renaming a directory in gulp

I'm using gulp-rename to rename a directory as follows: gulp.task('vendor-rename-pre', function() { return gulp.src('src/vendor') .pipe(rename('vendor-dev')) .pipe(gulp.dest('src')); }); However, it essentially ends up creating a new,…
Gezim
  • 7,112
  • 10
  • 62
  • 98
2
votes
0 answers

Gulp-concat and gulp-rename: file.dirname not working

I'm currently using gulp concat to concatenate every js file in a root/**/js directory, and i want to move them in another folder. I was using the file.dirname of gulp-rename to ensure that my destination folder would match the /**/ of the source,…
Jorel Amthor
  • 1,264
  • 13
  • 38
2
votes
2 answers

gulp-rename creating unnecessary directories

I am using gulp to resize and rename some images: var gulp = require('gulp'); var imageResize = require('gulp-image-resize'); var changed = require('gulp-changed'); var rename = require('gulp-rename'); var resizeImages = function resize(options) { …
Edward
  • 3,429
  • 2
  • 27
  • 43
2
votes
2 answers

gulp-changed / gulp-newer + gulp-rename don't work

I try to bypass minifying, resizing and renaming already processed images, and adding 'gulp-changed' changed nothing for me; all the files are processed, еvery time. I tried 'gulp-newer' instead, but still with no luck. Later, I've figured out - if…
Mikhail Vasin
  • 2,421
  • 1
  • 24
  • 31
2
votes
2 answers

Renaming a file with gulp rename and adding an index

I need to rename a batch of photos adding an index to them, like 'image-1-tmb' or 'image-23-tmb'. I have already searched this and didn't find it, didn't even come close to finding it. This is my actual code: gulp.task('rsz_tmb_menu',function(){ …
2
votes
2 answers

gulp-uglify minifying script that it is not supposed to

When I run gulp scripts, both all.js and all.min.js end up minified. Anybody know why this happens? gulp.task("scripts", function() { var concatted = gulp.src(['js/first.js', 'js/second.js']) .pipe(concat('all.js')); …
Colin Marshall
  • 2,142
  • 2
  • 21
  • 31
1
2 3 4