caffeinated / themes

:art: Laravel Themes package with support for the Caffeinated Modules package.

Home Page:https://caffeinatedpackages.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Theme::asset fails to get versioning asset

ariews opened this issue · comments

Hi, thanks for this package. It helps me a lot. I'm not speak english.

Env: L5.4, PHP 5.6, caffeinated/themes:^3.0

When developing I can use Theme::asset to get css and js file, but in production I often used .version() when build asset.

Theme::asset('css/app.css');
// http://localhost/themes/theme-name/assets/css/app.css

My workaround, add a helper function:

if (!function_exists('theme_assets')) {
    /**
     * @param string $asset
     *
     * @throws \Exception
     *
     * @return \Illuminate\Support\HtmlString
     */
    function theme_assets($asset)
    {
        return mix(preg_replace('!/{2,}!', '/', sprintf(
            '/%s/%s/assets/%s',
            config('themes.paths.base'),
            Theme::getActive(),
            $asset
        )));
    }
}

It's would be nice to get asset also version asset with Theme::asset.

Any support for this? Thanks.

edit note: add caffeinated/themes version