Skip to content

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

Open

Description

@mickeyreiss

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!

Activity

  1. jrburke commented on Feb 20, 2013

    @jrburke
    Member

    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.

  2. mickeyreiss commented on Feb 20, 2013

    @mickeyreiss
    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?

  3. jrburke commented on Feb 20, 2013

    @jrburke
    Member

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

  4. webuniverseio commented on Apr 25, 2015

    @webuniverseio

    @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.

  5. masterspambot commented on Jan 4, 2016

    @masterspambot

    👍

  6. modified the milestones: 2.2.0, 3.0 on Mar 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions