Skip to content

Accept a transforming function as an option #165

@bmancini42

Description

@bmancini42

It would be nice to have an additional option possibility for using a transforming function on the path. RegExs are suitable for most situations, but sometimes you want to have a smarter transformation.

In my case, I had been using a webpack resolver function to basically:

1 - Find a reserved string in the old path
2 - Replace the reserved string with a configured param
3 - If that transformed file exists, use it as the new path
4 - Otherwise, use a fallback path

This requires processing specific to each path, rather than just a simple transformation you could do with the same RegEx to all paths.

I happened on the idea of using this plugin to do this instead, since my ava tests were not using webpack's resolve plugin, but this would require that this plugin be extended to allow for a transforming function as an option.

cf #164

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions