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
1
vote
1 answer

Reloading js files and error out

No matter what I try, I can't seem to get my gulp to run without autoreloading my files and it errors after completion. Any help would be greatly appreciated. Using OSX 10.10 (although same issue with 10.9) Sass: 3.4.7 Node: v0.10.33 Ruby:…
Kevin Ham
  • 51
  • 1
  • 3
0
votes
1 answer

How to rename images by template with gulp?

I have images with different titles: !test.png 1101.png 12345.jpg image3.jpg image4.jpg image5.jpg image6.jpg image7.jpg test_test.png test.jpg test2.png I need images with next…
Mac
  • 13
  • 3
0
votes
1 answer

GULP: rename the affected file only

I want to create a copy with a new extension in the same folder only of the file which was changed. How should src and dest be specified? var gulp = require('gulp'), rename = require("gulp-rename"), watch = require('gulp-watch'); var filePath =…
o-sapov
  • 320
  • 2
  • 13
0
votes
1 answer

Gulp AWS Publish. How to remove *.html extension and then add content-type to text/html?

I'm new to gulp. I'm using a gulp task to do an AWS publish. Before publishing, I want to rename all html files with no extension (i.e., remove extensions). Then publish the content with two different headers in order to force content-type to…
0
votes
2 answers

Gulp uglify, rename and sourcemaps

I'm trying to do the following in Gulp: 1) Minify JS files from a specified folder to a folder called 'dist'. 2) Append '.min' to the minified filenames. 3) Provide a sourcemap to the minified files and place them in a folder called 'maps'. I am…
Tim
  • 881
  • 8
  • 19
0
votes
1 answer

Rename one file during copying process with Gulp

I want to automate the process of packing my extension for Chrome and Firefox and for that I'm using Gulp. I have two different manifest files, one for Chrome and one for Firefox (manifest.json and manifestff.json) in the root directory of the…
Nikola Stojaković
  • 2,257
  • 4
  • 27
  • 49
0
votes
1 answer

Remove space from filename using Gulp Rename

I'm trying to create a Gulp task that replaces spaces from filename with underscores. Here's what I have: gulp.task("underscore", function (done) { gulp.src("src/**/*.{jpg,jpeg}") .pipe(changed("dist")) //Remove Space …
0
votes
1 answer

Gulp.dest() when using multiple globs

I'm having trouble with a glob and gulp.dest(). My task looks like this return gulp.src('./clients/*/assets/less/*.less',{ base: process.cwd() }) .pipe(less({ paths:[path.join(__dirname, 'less')] }).on('error', function(err){ …
0
votes
1 answer

Programmatically passing directory name as string to gulp-rename

Is it possible to pass the name of the parent directory to gulp-rename or any other renaming plugin? I'm trying to programmatically concatenate all the files in the 'src' folders and rename them with the name of their parent directory. Code below is…
lloan
  • 1,383
  • 8
  • 23
0
votes
0 answers

Gulp dest at same level src

i am trying do make a gulp task to compile a lot of modules at same time. My paths are... packages/module1/src/file.js packages/module2/src/file.js packages/module2/src/sufolder/subfile.js What i need to acomplish wirh gulp…
Felipe Deitos
  • 164
  • 1
  • 1
  • 11
0
votes
2 answers

Gulp-rename: get original file path

I'm using gulp-rename to rename files. I want to get files from few directories and put 'em into output directory with some postfix.This postfix depends on original directory name: ['/dir/a/style.css', '/dir/b/style.css',…
Legotin
  • 2,378
  • 1
  • 18
  • 28
0
votes
2 answers

gulp var defined in one pipe is undefined in another

I am using gulp to processes pages for a site, some of these pages are php files. The problem is that after all the pages are run through the template engine they have a .html file extension. I am adding a property to the file that designates if…
binary-idiot
  • 119
  • 1
  • 9
0
votes
1 answer

gulp extname on Angularjs2 files with two dots

Below gulp rename task works good for angularjs2 ts files with one dot, such as appcomponent.ts. However, if the file name has two dots like login.service.ts, gulp extname is confused and will take whatever after the first dot as the extension. Any…
Hammer
  • 8,538
  • 12
  • 44
  • 75
0
votes
1 answer

Changing output directories/files to lowercase in Gulp

I'm using Gulp to automatically copy/bundle/compile my files, I basically copy the entire folder structure from the base folder (MyProject/Scripts) to wwwroot/js. In the process of copying/processing I want to rename the output path/filenames to…
0
votes
1 answer

Gulp-rename files only and not directories

function javascriptSites() { return gulp.src(PATHS.javascriptSites) .pipe($.sourcemaps.init()) .pipe($.babel()) .pipe($.if(PRODUCTION, $.uglify() .on('error', e => { console.log(e); }) )) .pipe($.if(PRODUCTION, $.rename({ suffix:…
tomster2300
  • 107
  • 2
  • 8