gulp-rev icon indicating copy to clipboard operation
gulp-rev copied to clipboard

Manifest.json not produced on multiple level folders

Open alejpelo opened this issue 7 years ago • 0 comments

Description

When the rev command is run everything works and revisioned files (unicorn.cssunicorn-d41d8cd98f.css) appear in the desired folder. However, when the rev.manifestcommand is invoqued, the rev-manifest.json file is not produced.

Steps to reproduce

I have the following folder structure with all my .min.css, .min.js and image (.jpg, .png, .jpeg) assets:

si-vet
│
└───siv
│   │   
│   └───static
│       │   
│       └───img
│       │   │   
│       │   └───folder_img1
│       │   │   │   img1.png
│       │   │   │   ...
│       │   │
│       │   └───folder_img2
│       │       │   img2.png
│       │       │   img3.jpg
│       │       │   ...
│       │   ...
│       │
│       └───vet
│           │   style.min.css
│           │
│           └───folder_vet1
│           │   │    script1.min.js
│           │   │    script2.min.js
│           │   │   ...
│           │
│           └───folder_vet2
│           │   │    script3.min.js
│           │   │    script4.min.js
│           │   │   ...
│           │   ...
│   ...

In order to get revisioned files in the same place as the original assets, I use the following gulp.task:

var gulp = require('gulp');
var rev = require('gulp-rev');

gulp.task('revision', function() {
  return gulp.src([
        'siv/static/img/**/*.{jpg,png,jpeg}',
        'siv/static/vet/**/*.min.css',
        'siv/static/vet/**/*.min.js'
        ],
        { base: 'siv/static' })
    .pipe(rev())
    .pipe(gulp.dest(function(file) {
        return file.base;
    }))
});

As I mentioed before, after this gulp.task is run, I get the revisioned files (unicorn.cssunicorn-d41d8cd98f.css) and the task finishes as expected:

alejandro@ubuntu:~/WebApp/si-vet$ gulp revision
[18:02:47] Using gulpfile ~/WebApp/si-vet/gulpfile.js
[18:02:47] Starting 'revision'...
[18:02:47] Finished 'revision' after 30 ms
alejandro@ubuntu:~/WebApp/si-vet$ 

However, when I include the command to get the rev-manifest.json file in the gulp.task, as follows:

var gulp = require('gulp');
var rev = require('gulp-rev');

gulp.task('revision', function() {
  return gulp.src([
        'siv/static/img/**/*.{jpg,png,jpeg}',
        'siv/static/vet/**/*.min.css',
        'siv/static/vet/**/*.min.js'
        ],
        { base: 'siv/static' })
    .pipe(rev())
    .pipe(gulp.dest(function(file) {
        return file.base;
    }))
    .pipe(rev.manifest({
        base: 'siv/static',
    }))
    .pipe(gulp.dest('siv/static'));
});

The task never finishes and the rev-manifest.json is not produced:

alejandro@ubuntu:~/WebApp/si-vet$ gulp revision
[18:03:14] Using gulpfile ~/WebApp/si-vet/gulpfile.js
[18:03:14] Starting 'revision'...
alejandro@ubuntu:~/WebApp/si-vet$ 

For the record I'm a gulp and gulp-rev newbie, so please excuse any mistakes in my approach. I tryed for several hours and read many websites but nothing has worked so far. I'm using Ubuntu 16.04 LTS, Node v4.2.6 and gulp-rev 8.1.0.

Thanks in advance for any help with the issue.

alejpelo avatar Nov 21 '17 23:11 alejpelo