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

fail to work with [email protected]

Open tryer3000 opened this issue 7 years ago • 2 comments

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())

tryer3000 avatar Nov 16 '16 06:11 tryer3000

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.

akatakritos avatar Dec 02 '16 14:12 akatakritos

@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())
``

jonlil avatar Jan 11 '17 20:01 jonlil