I have a directory and want to exclude a few files like Ant does, is this possible with webassets?
Or does if bundle could take a list or tuple, which doesn't seem to be the case?
The Bundle
constructor signature looks like this (from the source at github):
def __init__(self, *contents, **options):
That means that the contents can be specified as a series of positional arguments, as in the example in the documentation:
Bundle('common/inheritance.js', 'portal/js/common.js',
'portal/js/plot.js', 'portal/js/ticker.js',
filters='jsmin',
output='gen/packed.js')
But it also means that you can use Python's ability unpack argument lists. From that page:
The reverse situation occurs when the arguments are already in a list or tuple but need to be unpacked for a function call requiring separate positional arguments. For instance, the built-in range() function expects separate start and stop arguments. If they are not available separately, write the function call with the *-operator to unpack the arguments out of a list or tuple
So you could just easily the write the example above as:
files = ['common/inheritance.js', 'portal/js/common.js',
'portal/js/plot.js', 'portal/js/ticker.js']
Bundle(*files, filters='jsmin', output='gen/packed.js')
and of course you can filter/slice/dice the list to your hearts content before bundling.