Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Theme::asset fails to get versioning asset #60

Closed
ariews opened this issue Sep 5, 2017 · 0 comments
Closed

Theme::asset fails to get versioning asset #60

ariews opened this issue Sep 5, 2017 · 0 comments

Comments

@ariews
Copy link

ariews commented Sep 5, 2017

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

@kaidesu kaidesu closed this as completed Dec 12, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants