corvid
corvid

Reputation: 11187

Can you use glob syntax inside of packages with meteor?

I have a package in meteor that gets a little tedious to add all the bits.

api.addFiles([
  'client/blah.jade',
  'client/blah.js',
  'client/blah.scss',
  // etc...
]);

By chance, does there exist a way to use glob syntax in order to add files to the api? For example:

api.addFiles('client/**/(*.js|*.jade|*.scss)');

I know node-glob exists, but can this be used within a package?

Upvotes: 0

Views: 112

Answers (1)

imkost
imkost

Reputation: 8163

api.addFiles does not support glob syntax, but you can use glob npm package:

Npm.depends({
  glob: '6.0.1'
});

Package.onUse(function(api) {
  var globSync = Npm.require('glob').sync;

  api.addFiles(globSync('client/**/(*.js|*.jade|*.scss)'));
});

Upvotes: 3

Related Questions