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

Already on GitHub? Sign in to your account

What is the recommended structure for adding XRegExp? #284

slevithan opened this Issue May 26, 2012 · 2 comments


None yet
3 participants

slevithan commented May 26, 2012

@ryankirkman , @thomasdavis , etc.

I'd like to add my XRegExp v2.0.0 library to cdnJS (I'll be sending a pull request after getting feedback on this issue). However, because of its collection of addons, there are a lot of associated script files. The most popular of them (listed with their paths in the XRegExp repo) are as follows:

  • src/xregexp.js
  • min/xregexp-min.js
  • xregexp-all.js
  • min/xregexp-all-min.js
  • src/addons/unicode/unicode-base.js

The remaining scripts are:

  • src/backcompat.js
  • src/addons/build.js
  • src/addons/matchrecursive.js
  • src/addons/prototypes.js
  • src/addons/unicode/unicode-categories.js
  • src/addons/unicode/unicode-scripts.js
  • src/addons/unicode/unicode-blocks.js
  • src/addons/unicode/unicode-properties.js

Would it be OK to add all of these? I'm thinking that for cdnJS I'd flatten the directory structure and simply include all of the the above scripts in an ajax/libs/xregexp/2.0.0/ directory.

Is including the individual XRegExp addons overkill for cdnJS? If so, perhaps I could just add xregexp-min.js and xregexp-all-min.js.


ryankirkman commented May 27, 2012

Hi Steven, it's fine to add all of those scripts. I would suggest concatenating the additional scripts if it makes sense to.

The reason is that the browser needs to open an additional connection to retrieve each of those resources. Page load times will be decreased, significantly so for mobile devices.

The other reason is that it simplifies using your library. I'd much rather copy 1 or 2 script tags into my page than 5 or 10.


slevithan commented May 27, 2012

Good to hear. I'll submit a pull request with all the scripts, shortly.

As for concatenating the scripts, that's what xregexp-all.js (and the minified copy, xregexp-all-min.js) does. :-) It includes XRegExp bundled with all addons except backcompat.js (which is only used for backward compatibility with XRegExp v1.x.x).

Thanks for the quick feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment