Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which path to a file does gulp-rev-all match regexes against? #187

Open
shark-horse opened this issue May 25, 2018 · 0 comments
Open

Which path to a file does gulp-rev-all match regexes against? #187

shark-horse opened this issue May 25, 2018 · 0 comments

Comments

@shark-horse
Copy link

Rather, given a file, what does gulp-rev-all think the path is?

gulp.src('.work/**/*', {base: '.work'})
  .pipe(revAll.revision({
    // works as expected:
    dontRenameFile: ['index.html', /favicon\.png/],
    // fails to make changes to index.html or app/main.js:
    dontSearchFile: [ /^(?!(index\.html|app\/main\.js)).*$/ ],
    dontUpdateReference: [ /^(?!(index\.html|app\/main\.js)).*$/ ]
  })
  .pipe(gulp.dest(...))
  ...

So a few more specific questions:

  1. When I pass in a string instead of a regex, how is that interpreted? The README shows an example of just providing .html to match all HTML files, and also I tried using glob syntax with a ** which gave me an error about an invalid regex. Is it some sort of "smart" matcher? Does index.html match path/to/index.html.bak?
  2. Does gulp-rev-all respect the base? I.e., does it see a file index.html or a file .work/index.?
  3. To prevent creating an additional problem, is there any option to pass e.g. a function or a gulp-filter instead of using a blasted regex? Or is there any sort of DoSearchFile or DoRenameFile option so I don't have to use complicated inverted regexes?

The reason I don't want to automagical renames on all our javascript files is that we have path configs in our RequireJS config, e.g.:

paths: {
  jquery: "lib/jquery.min"
  coolWidget: "app/ui/widgets/text/awesomeKind/coolWidget"
}

with a few hundred entries or so, and each .js file in our code references its dependencies:

define(['jquery', 'coolWidget'], function(jquery, coolWidget) {...});

(For now, let's focus on .js files. I know I will have to update references in .css and other file types later.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant