Skip to content
This repository has been archived by the owner on Sep 6, 2020. It is now read-only.

Mapping Paths

Compare
Choose a tag to compare
released this 20 Jul 13:56
· 75 commits to master since this release

In this release, a new map setting has been added.

{
    "map": [
        { "path/to/match": "path/to/replace/with" },
        { "": "new/root/path/" }
    ]
}

As you can see, the setting is an array of objects. Each object is expected to have a single key/value pair, where the key is a path segment to match, and the value is the new segment to replace it with. Note that only relative paths, which begin with the path segment defined by the object key, will be matched.

Using the example above:

Before After
path/to/match/file.php path/to/replace/with/file.php
path/to/match/sub/file.php path/to/replace/with/sub/file.php
another/path/file.php new/root/path/another/path/file.php

An empty object key is a global match. However, instead performing path segment replacement, the value will be prefixed to the path that was matched. Don't forget to add a trailing slash for directory paths!

This could prove to be useful for Composer dependencies that have a target-dir set.

Thank you, @lyrixx, for the request!