Skip to content

@js blade directive is broken #152

@acip

Description

@acip

Asset class not found.

in registerBladeDirectives

        Blade::extend(function ($value) {
            return preg_replace_callback('/\@jsIn\s*\(\s*([^),]*)(?:,\s*([^),]*))?(?:,\s*([^),]*))?(?:,\s*([^),]*))?\)/',
                function ($match) {

                    $p1 = trim($match[1], " \t\n\r\0\x0B\"'");
                    $p2 = trim($match[2], " \t\n\r\0\x0B\"'");
                    $p3 = trim(empty($match[3]) ? $p2 : $match[3], " \t\n\r\0\x0B\"'");
                    $p4 = trim(empty($match[4]) ? '' : $match[4], " \t\n\r\0\x0B\"'");

                    if (empty($p4)) {
                        return "<?php Asset::container('$p1')->script('$p3', theme_url('$p2'));?>";
                    } else {
                        return "<?php Asset::container('$p1')->script('$p3', theme_url('$p2'), '$p4');?>";
                    }

                }, $value);
        });

if @js('something') is used, it triggers the above exception: Asset class not found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions