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:

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.