Roots Discourse

[Sage 10] Get local asset path

In Sage 9 there is the \App\locate_asset function that returns the local path to an asset. Is there also such a function in Sage 10? \Roots\asset returns the URL, I need to get the local path of the file.

I believe \Roots\asset() returns an Asset object, which has a path() method that returns the path: https://github.com/roots/acorn/blob/70452f2cf768aaea7c452df32db27a1162e7c515/src/Roots/Acorn/Assets/Asset.php#L43-L46

Are you just echoing it? The Asset class has a __toString() method that returns the URL if the Asset is treated like a string.

1 Like

IMHO this is a very elegant implementation.