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

fileExclusionRegExp behavior with multiple files/directories with the same name #384

Open
mickeyreiss opened this issue Feb 18, 2013 · 5 comments
Milestone

Comments

@mickeyreiss
Copy link

Hi there!

I've noticed a limitation in the fileExclusionRegExp configuration option.

I'm using "Optimizing a Whole Project"-style compilation with a number of modules, and I'm having trouble specifying the set of files I'd like to copy over to the build directory.

Here's a simplified directory listing of my project:

/app/scripts/a.js
/app/scripts/b.js
/app/scripts/c.js
/tools/scripts/d.js

The Problem

During compilation, I would like a, b and c to be copied over but I'd like to ignore d.js as it is not intended for distribution.

  • I tried fileExclusionRegExp: /^scripts$/, but that excludes all 4.
  • I tried fileExclusionRegExp: /tools\/scripts/, but that excludes none of the 4.
  • I've tried a few more similar permutations, but I couldn't figure out a way to include all files in /app/scripts without the files in /tools/scripts.

The Workaround

The only workaround I've been able to find is to rename /tools/scripts to something different. This feels kludgy to me; why shouldn't fileExclusionRegExp support multiple files or directories with the same name?

Potential Solutiosn

Some solutions come to mind, such as executing the provided RegExp on relative project paths (i.e. /app/scripts/a.js instead of scripts and a.js). Another idea would be to reinstate functionality for excluding particular directories.

Thanks!

@jrburke
Copy link
Member

jrburke commented Feb 20, 2013

I can see where a kind of fullPathExclusionRegExp might be useful. Although, r.js cannot do all the kinds of exclusions a developer may want, and relying on post-r.js build processes are still suggested for maximum flexibility.

Putting this in the 2.2.0 bucket for consideration.

@mickeyreiss
Copy link
Author

What, exactly do you mean by post-r.js build processes? Is that essentially a script that goes through my r.js build directory and deletes unnecessary files?

@jrburke
Copy link
Member

jrburke commented Feb 20, 2013

Yes, or if you have a script that drives r.js now, adding the removal after the r.js step.

@webuniverseio
Copy link

@jrburke I also find that it would be very useful to be able to be able to use more flexible regular expressions. In projects, which have bower_components with hundreds of dependencies, developers have to be extra careful with what they exclude from the build. Being able to use something like that would be extremely beneficial for build time. Thank you.

@masterspambot
Copy link

👍

@jrburke jrburke modified the milestones: 2.2.0, 3.0 Mar 15, 2016
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

4 participants