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

Does not work at all

Open mparisi76 opened this issue 9 years ago • 12 comments

Version 0.1.6

I have in client/index.html:

<script src="lib/js/vendor.min.js?rev="></script>

In Gulp:

gulp.task('rev', function() { gulp.src('client/index.html') .pipe(rev()) .pipe(gulp.dest('./dist')); });

In my html and after running gulp, output file is same.

mparisi76 avatar Dec 16 '15 15:12 mparisi76

@mparisi76 please try:

<script src="lib/js/vendor.min.js?rev=@@hash"></script>

And let me know the results.


I can see in the documentation where it may be confusing:

"The only requirement is that the dependency to be appended with the hash be declared using `?rev=`. The `@@hash` is not required, and any value will be overriden as the dependency file contents change."

In fact, i believe it needs at least one character - any character or string - in order to perform the regex matching:

"... using the following regex: (?:href|src)="(.*)[\?]rev=(.*)[\"]"

bustardcelly avatar Dec 17 '15 14:12 bustardcelly

no, this doesn't seem to work at all...

ps2goat avatar Jun 02 '16 22:06 ps2goat

+1

omarmeky avatar Jun 22 '16 15:06 omarmeky

+1

1-0-1 avatar Aug 29 '16 16:08 1-0-1

+1

volodya-buryy avatar Sep 16 '16 12:09 volodya-buryy

+1

nomadinjax avatar Jan 27 '17 18:01 nomadinjax

+1

mattfroese avatar Feb 13 '17 20:02 mattfroese

hrm :/

Getting a lot of +1's on this. Quick question so I can help to resolve:

Is it a +1 on this example not working:

<script src="lib/js/vendor.min.js?rev="></script>

or this example not working (which is supported and tested)?

<script src="lib/js/vendor.min.js?rev=@@hash"></script>


I may need more steps to reproduce what seems to be the problem for you all. I just installed 0.1.7 and did a basic test against the latter example and it worked as expected. As well, all the test pass.

Please let me know, so I can assist further.

bustardcelly avatar Feb 14 '17 01:02 bustardcelly

<script src="js.js?rev=@@hash"></script>
<link rel="stylesheet" href="common.css?rev=@@hash">
<link rel="stylesheet" href="ll.css?rev=@@hash">

after build ↓↓↓↓↓

Nizhiwei avatar Jun 30 '17 09:06 Nizhiwei

It worked for me, but only on a gulp.watch. If I do it from a gulp.task() directly, it doesn't work. I believe this is happening because the files aren't available for hashing when the revision appender runs on build. So I need to use runSequential to run the HTML part after all the assets have been created.

Sawtaytoes avatar Oct 26 '17 17:10 Sawtaytoes

Hi @Sawtaytoes , can you put an example please with gulp.watch, for me not work too.

anjopater avatar Dec 06 '17 21:12 anjopater

The issue most people are probably having is that Gulp runs tasks concurrently. This is great in normal operation, but if you're copying files around and generating the public folder, your index.html file might not exist when you run gulpRevAppend. Doing them in sequence like this where buildIndex occurs after build will get it working.

You'll need to do something like this where you utilize runSequence to get your tasks running in a certain order:

ES2015+

const gulp = require('gulp')
const runSequence = require('run-sequence')

gulp.task(
  'deploy',
  callback => runSequence('clean', 'build', 'buildIndex', callback)
)

ES5

'use strict';

var gulp = require('gulp');
var runSequence = require('run-sequence');

gulp.task('deploy', function (callback) {
  return runSequence('clean', 'build', 'buildIndex', callback);
});

Sawtaytoes avatar Dec 06 '17 22:12 Sawtaytoes