copy-files-from-to
copy-files-from-to copied to clipboard
Support for Resources with Multiple Extensions in Path
Description
I would like to suggest an enhancement to support resources with multiple extensions in the path.
This feature is particularly useful in scenarios where a project contains files with multiple extensions, without having to specify a block for each extension individually.
Many libraries support this by using (first_extension|second_extension). In the context of copy-files-from-to, for instance, it could be something like:
{
"from": "node_modules/module_name/dist/js/module_name.min.(js|map)",
"to": "static/module_name/scripts/"
},
@x80486 Thank you for the report :smile:
This issue is happening due to the change https://github.com/webextensions/copy-files-from-to/commit/2c6e6256fe2661e2d60fae9d73018c3a71e60ee5 which was done to fix https://github.com/webextensions/copy-files-from-to/issues/21
While that fix is not ideal, currently it works in an ok enough manner for general use cases.
Currently, we auto-detect to guess the intention of the user whether they are using "glob" or not. This simplification in terms of configuration adds some complexity which leads to this conflict mentioned above.
Probably an ideal solution would need either improvement in logic (like probably detecting the "glob" a bit earlier based on the configuration) or changing the config style a bit to let the user be explicit. As per a quick analysis, it seems that this might lead to slightly bigger changes.
So, for now, we will leave this issue open to be revisited later on. In the meantime, we recommend to use a workaround for such cases by utilizing "glob" like:
{
"from": "node_modules/module_name/dist/js/module_name.min.*",
"to": "static/module_name/scripts/"
}
Hope that helps. Cheers!