Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in rev-manifest.json file path #251

Open
junaidahmed92 opened this issue Oct 25, 2018 · 4 comments
Open

Issue in rev-manifest.json file path #251

junaidahmed92 opened this issue Oct 25, 2018 · 4 comments

Comments

@junaidahmed92
Copy link

junaidahmed92 commented Oct 25, 2018

I am using gulp-rev and it is working fine. But I have one issue. I have multiple gulp task and I want to keep track of all in rev-mainfest.json file so I am providing merge:true config in rev.manifest() but it is not creating the file on the path I am providing but at the root level of directory.
Here is how I am providing the path:

    .pipe(rev())
        .pipe(gulp.dest('scripts/bundles/'))
        .pipe(rev.manifest({
            base: 'scripts/revisions/',
            merge: true
        }))
        .pipe(gulp.dest('scripts/revisions/'));

What am I missing here. Also one more thing I have noticed that it only generates file when there is any change but in documentation it's written that we should also use gulp-changed. Why is that?

@iamjaredwalters
Copy link

iamjaredwalters commented Nov 6, 2018

Same issue here.

Dependencies:

"gulp-rev": "^9.0.0", "gulp": "^4.0.0",

Example task:

const postcssPlugins = [
    autoprefixer({
        browsers: ['last 2 versions', 'ie 11']
    })
];

const minifiedFileExtension = rename({
    extname: '.min.css'
});

if (options.prod) {
    postcssPlugins.push(cssnano);
}

gulp.src(config.paths.css.src)
    .pipe(plumber())
    .pipe(rev())
    .pipe(sourcemaps.init())
    .pipe(sass().on('error', sass.logError))
    .pipe(postCss(postcssPlugins))
    .pipe(gulpIf(options.prod, minifiedFileExtension))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(config.paths.css.dest))
    .pipe(
        browserSync.reload({
            stream: true
        })
    )
    .pipe(
        rev.manifest('manifest.json', {
            cwd: 'web/app/dist',
            merge: true
        })
    )
    .pipe(gulp.dest('web/app/dist'));

@iamjaredwalters
Copy link

To follow up, it seems that if a manifest.json already exists then the manifest is merged and placed where expected, in this case web/app/dist. If a manifest.json does not exist then the manifest is placed in the root which Im guess is process.cwd() in my case.

@iamjaredwalters
Copy link

Looks like using path solves this for me 🤔

rev.manifest('manifest.json', { path: 'web/app/dist', merge: true })

@junaidahmed92
Copy link
Author

@iamjaredwalters I already solved this issue but thanks for the answer. Can you tell me one more thing is there any way to keep track of all files in rev-mainfest.json? Right now if we make change in js file and execute gulp command then it overrides the file name in rev-mainfest.json but I want to keep track of all files like:

{
"module-min.js": "module-min-a2720m2695.js",
"module-min.js": "module-min-asdasj2j3j3.js",
"module-min.js": "module-min-adskj2n311.js",
....
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants