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

Provide include config field to overwrite exclude #4

Open
xixixao opened this issue Jan 1, 2014 · 1 comment
Open

Provide include config field to overwrite exclude #4

xixixao opened this issue Jan 1, 2014 · 1 comment

Comments

@xixixao
Copy link

xixixao commented Jan 1, 2014

As discussed, I would like to be able to provide a config field include, f.e.:

requireCommonjs:
  include: "/vendor/specialLib"

This would be that although vendor folders are excluded from the commonjs wrapping, the specialLib folder would be wrapped if appropriate.

I looked into implementing this, and I can see that this code:

if mimosaConfig.requireCommonjs?.excludeRegex? and file.inputFileName.match mimosaConfig.requireCommonjs.excludeRegex
  # skipping via regex
else if mimosaConfig.requireCommonjs.exclude.indexOf(file.inputFileName) > -1
  # skipping via string

is repeated across several modules. Could we simplify the API? It is also not clear from the module code that its actually the validator that does the necessary work of converting array of regexes into a single regex (maybe that's just because it didn't evoke "validation").

I think there can be (and probably are) different exclude fields, so I'd imagine something like:

if matcher = mimosa.configHelpers.excludes mimosaConfig.someModule, "excludeFoos", "includeFoos", file
  logger.debug "skipping bar wrapping for %path, file is excluded via #{matcher}", file
@xixixao
Copy link
Author

xixixao commented Jan 1, 2014

Oh, and one more suggestion is to handle path / vs \ automatically inside the regexes/strings - this would allow the default to change to simple

['/vendor/', /\/main[\.-]/]

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