How to get the theme path?

  • Hi, i am using mix in my build tasks, and mix.version, therefore in order to get the versioned assets in my views I need to get them using {{ mix('/themes/mytheme/css/app.css') }} - how do i get the current theme's path i.e. /themes/mytheme?

    I have tried Theme::url but this returns the full url including the host/domain (even though the method comments say "This is not a full URL.".


  • Global Moderator

    Hey, @pavsid.

    Yeah, this sux with Stylist HTMLbuilder there's good method that is protected :(

    Here's helper function that can do whats protected:

        // usage: relativeThemeAssetUrl('assets/css');
        function relativeThemeAssetUrl($url)
            $theme = \Stylist::current();
            if ($theme) {
                $themePath = $theme->getAssetPath();
                $url = "themes/$themePath/$url";
                return $url;
            return false;

  • @armababy Great, many thanks :)

Log in to reply

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.