jcreamer898
jcreamer898

Reputation: 8189

Requirejs optimize tool exclude folders

I am trying to optimize a project with r.js and am confused about how to exclude a certain folder from the copy step. My structure is...

/index.htm
/scripts/main.js
/scripts/require.js
/scripts/libs/jquery/jquery.js
/scripts/libs/other/ /* I want NONE of this folder to be moved to the build */

Is it possible to do this?

Upvotes: 19

Views: 11220

Answers (2)

jacob.toye
jacob.toye

Reputation: 1222

In your build config you can exclude files and folders using the fileExclusionRegExp property.

So for you example you would have:

fileExclusionRegExp: /^other$/

This will exclude any folders or files called other.

Upvotes: 30

ggozad
ggozad

Reputation: 13105

Yes, the documentation provides you with several ways of doing this:

  1. for a start only the dependencies listed in main.js's require and their own dependencies will be included.
  2. Assuming that what you have in /other/ is a dependency but you still don't want them in, you can use shallow exceptions, or define them in the require.js config paths and use the empty: scheme.

Upvotes: 0

Related Questions