# Access relative `dist` path

**URL:** https://discourse.roots.io/t/access-relative-dist-path/9584
**Category:** sage
**Tags:** sage9
**Created:** 2017-05-12T23:00:44Z
**Posts:** 4

## Post 1 by @zackcote — 2017-05-12T23:00:44Z

Is there an easy way to get the _relative_ path of an asset? How can I access the relative path of the `/dist` folder? `App\\asset_path()` returns the full uri. I have a case where I’m using `file_get_contents` to display inline SVGs and i need to provide the relative path, in my case `'~/sitename/web/app/themes/ttg-theme/dist/images/svg/file.svg'`.

**Edit:** Especially considering `get_template_directory()` now, returns the ‘resources’ folder, I can’t find an easy way to get the ‘dist’ folder.

**Re-edit:** This is my current code which requires the hardcoded theme path:

```
/**
     * Create @svg() Blade directive
     */
    sage('blade')->compiler()->directive('svg', function ($svg, $size = 'inherit') {
        return "<?= file_get_contents(get_theme_root() . '/theme-name/dist/images/svg/' . $svg . '.svg'); ?>";
    });
```

---

## Post 2 by @strarsis — 2017-05-13T12:08:18Z

What about

> **[adamwathan/blade-svg](https://github.com/adamwathan/blade-svg)**
>
> Contribute to blade-svg development by creating an account on GitHub.

---

## Post 3 by @isabisa — 2017-12-16T22:46:25Z

I’m running into this issue now. It’s not my first time using this function in a Sage9 theme so I’m not sure why I’m just now having this problem. Did you find a solution?

I’m going to look into some previous themes I developed to see what the difference is. Maybe that’ll lead to a solution that I can share.

---

## Post 4 by @alwaysblank — 2017-12-17T00:45:53Z

I just ended up writing my own function and creating a new config entry to simplify things. I posted them in another thread: [https://discourse.roots.io/t/svg-sprites-workflow/10903/12?u=alwaysblank](https://discourse.roots.io/t/svg-sprites-workflow/10903/12?u=alwaysblank)
