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

Smarter regex or options needed for this case

Open binarykitchen opened this issue 10 years ago • 1 comments

For application-specific reasons I only store the file name and its subfolder in the revision file like this

{
  "logo.png": "logo-afc86ade.png",
  "wait/wait1.gif": "wait/wait1-e244a2fd-e244a2fd.gif",
  ...
}

for them images, in the CSS I have these lines:

background: url("/img/logo.png")
background-image: url("/img/wait/wait1.gif")

None of your gulp options and default regex won't support this.

I think we need another option to prepend a subfolder to the regex. In my case something like this:

        .pipe(fingerprint('/img/rev-manifest.json'), {
            prependToRegex: '/img/'
        }))

so that

background-image: url("/img/wait/wait1.gif")

becomes

background-image: url("/img/wait/wait1-e244a2fd-e244a2fd.gif")

Agree @vincentmac?

binarykitchen avatar Aug 07 '14 12:08 binarykitchen

By the way, if I use these two options it works like I wanted it to be:

  base:   'img/',
  prefix: '/img/'

binarykitchen avatar Aug 07 '14 13:08 binarykitchen