URL to Path / Path to URL

Concerning issues with minit WordPress plugin: https://github.com/kasparsd/minit/issues/107

Because Bedrock uses different paths for wp content/plugins/theme(s),
minit currently can’t convert these from URL to Path or later back from Path to URL.

It is relatively easy to convert the URL to Path by trying out plugins URL prefix and then themes URL prefix - but converting the Path back to URL later for adjusting paths in concatenated CSS/JS files is hard because it is not known whether the path in question points to a Plugin or a Theme or Content or even some special Path.

Is there an intelligent, re-usable method for mapping the URL to Path and the other way around with custom paths like in Bedrock?

Don’t think there is. Seems you’d have to do what you already mentioned. Use the built in functions or constants to get either a path/URL, and basically str_replace with some manipulation for whatever you want.