jamesknelson / gulp-rev-replace

Rewrite occurences of filenames which have been renamed by gulp-rev
MIT License
388 stars 62 forks source link

fail to work with gulp-sourcemaps@1.9 #69

Open tryer3000 opened 8 years ago

tryer3000 commented 8 years ago

rev-replace will replace original

<script> x.js</script>

with

<script>x.somehash.map</script>

Here is my gulp task:

    .pipe(useref())
    .pipe(jsFilter)
    .pipe(sourcemaps.init())
    .pipe(ngAnnotate())
    .pipe(uglify({preserveComments: uglifySaveLicense})).on('error', conf.errorHandler('Uglify'))
    .pipe(rev())
    .pipe(sourcemaps.write('maps'))
    .pipe(jsFilter.restore)
    .pipe(revReplace())
akatakritos commented 8 years ago

Oh I'm so glad I'm not the only one.

I worked around this with a filter that filtered out map files:

  const removeMapFiles = filter(['**/*', '!maps/**')], {restore: true});

// gulp stuff here...

    .pipe(removeMapFiles) // remove map files from the stream because we don't want them written to the markup
    .pipe(revReplace())
    .pipe(removeMapFiles.restore)

Here's a tiny reproducible project: https://github.com/akatakritos/gulp-rev-replace-repro

I'll look into a fix this afternoon as well.

jonlil commented 7 years ago

@akatakritos - thanks, that solved my issue. But you have some small issues in example


  const removeMapFiles = filter(['**/*', '!maps/**'], {restore: true});

// gulp stuff here...

    .pipe(removeMapFiles) // remove map files from the stream because we don't want them written to the markup
    .pipe(revReplace())
    .pipe(removeMapFiles.restore())
``