Giter Club home page Giter Club logo

gulp-fingerprint's People

Contributors

binarykitchen avatar holden-caulfield avatar tenphi avatar vincentmac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gulp-fingerprint's Issues

Broken with Gulp v4

Prints this error TypeError: file.pipe is not a function coming from line 125 of gulp-fingerprint/index.js:125:12

Processing SVG font URLs

While the plugin works fine for translating url() imports for regular images and most fonts, it ignores fonts that require a specific target. For instance:

src: url("OpenSans-Regular.svg#dc56f0938c09c27a4156bb0f8f5176a2")

won't be altered when I run the CSS through fingerprint().

If the url parameter contains ?, then the path is ignored too, as illustrated here:

src: url("OpenSans-Regular.eot?#iefix")

My suggestion would be to look for a specific target (the # or ? and anything after) and insert the rev'd path before it.

Smarter regex or options needed for this case

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?

requiring rev-manifest

Just going through the doc atm, im getting problem on requiring the rev-manifest.json file.

var manifest = require('../../dist/rev-manifest');

I get this error Error: Cannot find module './path/to/rev-manifest'. Does require not work for json files anymore, and has to be modules ?

Should it be:

var manifest = '../../dist/rev-manifest';

Stops in the middle without any output

[16:57:59] Starting 'stylus'...
[16:58:01] gulp-fingerprint Found: img/logo.png
[16:58:01] gulp-fingerprint Replaced: /img/logo-afc86ade.png
[16:58:01] gulp-fingerprint Found: img/bk_tiny_logo_alpha_wo_slogan.png
[16:58:01] gulp-fingerprint Replaced: /img/bk_tiny_logo_alpha_wo_slogan-f56e0724.png
[16:58:01] gulp-fingerprint Found: img/deafradio.png
[16:58:01] gulp-fingerprint Replaced: /img/deafradio-15e458e4.png
[16:58:01] gulp-fingerprint Found: img/wait/wait1.gif
[16:58:01] gulp-fingerprint Replaced: /img/wait/wait1-5d02e7fc.gif
[16:58:01] gulp-fingerprint Found: img/wait/wait2.gif
[16:58:01] gulp-fingerprint Replaced: /img/wait/wait2-445ed196.gif
[16:58:01] gulp-fingerprint Found: img/wait/wait3.gif
[16:58:01] gulp-fingerprint Replaced: /img/wait/wait3-8c9b2abd.gif
[16:58:01] gulp-fingerprint Found: img/wait/wait4.gif
[16:58:01] gulp-fingerprint Replaced: /img/wait/wait4-7a2a5429.gif
[16:58:01] gulp-fingerprint Found: img/wait/wait5.gif
[16:58:01] gulp-fingerprint Replaced: /img/wait/wait5-dc95886a.gif
[16:58:01] gulp-fingerprint Found: img/wait/wait6.gif
[16:58:01] gulp-fingerprint Replaced: /img/wait/wait6-eb1fd340.gif
[16:58:01] gulp-fingerprint Found: img/wait/wait7.gif
[16:58:01] gulp-fingerprint Replaced: /img/wait/wait7-795a37c0.gif

gulp-fingerprint is behaving weird and seems to exit without any further information. I expect my gulp stylus task to end properly but once the fingerprint part is running, the whole task aborts without any information.

Automatically call require when it's a path

Hello again

Currently I have .pipe(fingerprint(require(PATH_2_JSON)))

but I think it would be more elegant if I could do just .pipe(fingerprint(PATH_2_JSON)) and you figure out internally if it's a json or a string. If it's a string, then automatically load it via require.

Is this suitable for production?

Hey! The current version of this project is 0.3.2, which under semantic versioning means that it isn't suitable for production usage because it's still in development.

If you consider this project stable enough to use in development, would you be able to bump the project to 1.0.0? Thank you!

Adjust regex to subfolder

Thanks for the nice plugin. Very useful!

So, I have a small request. My rev json looks like:

{
  "logo.jpg": "images/logo-2d4a1176.jpg",
  "some-image.png": "images/some-image-abd84705.png"
}

and in my CSS I have url("/img/logo.jpg")

It won't work like that because the img/ part is missing in the json. But I do not want to change this for other reasons.

Probably we need a new option here to define the subfolder which will automatically adjust the regex. Or do you have a better idea?

Regex captures `url()`

Hey -- the standard regex (https://github.com/vincentmac/gulp-fingerprint/blob/master/index.js#L22) uses the star operator to capture urls, which results in, e.g., url() being matched, with no capture group. That then causes a failure because the code here https://github.com/vincentmac/gulp-fingerprint/blob/master/index.js#L58 returns the match index, not the matched text.

This won't happen if you use the + operator instead.

Sorry I don't have time to create a PR or tests for this -- thought at least I could let you know.

Be able to take in .pipe(rev.manifest())

Currently to use gulp-fingerprint with gulp-rev, you have to have them as two separate, synchronous tasks. The more gulp-y way of making this work would be a syntax like the following:

gulp.task("revision", function() {
  return gulp.src("my/files/**/*")
    .pipe(rev())
    .pipe(gulp.dest("dist/")) // write revisioned files
    .pipe(rev.manifest()) // build manifest
    .pipe(fingerprint()) // use built manifest from stream
    .pipe(gulp.dest("dist/")); // write manifest + fingerprinted files
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.