Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fixes Conflict of @js @css with L9+ #149

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Saifallak
Copy link

@Saifallak Saifallak commented Oct 30, 2024

	/*
	|--------------------------------------------------------------------------
	| Laravel introduced the @js directive in Laravel 9, released on February 8, 2022.
	| This directive was added to simplify safely passing PHP data to JavaScript
	| within Blade templates, eliminating the need for manual JSON encoding and escaping,
	| which was commonly done with json_encode() in older versions.
	|
	| which may conflict with you if you're (or package ex: filament) using it.
	| so you might want to disabled registering this package @js @jsIn @css blade directives.
	|--------------------------------------------------------------------------
	*/

	'register_blade_directives' => true,

so when using any package using @js helpers or by myself using @js in some code, getting crash ASSET is not defined and Array called on and many many others errors, at first I didn't understand from where it's coming from, but after 2 days of debugging I found it was because of @js helpers and searched which packages causing it, and it was this package,
I think that's because that the package was created from L5+,
I though of renaming it to @themeJS, but I see users on L9 Commit 94fed84d L10 #143 L11 #145 already using it.
so this will be a breaking change for them.
So I added an option to disable it for users who have conflicts like me.
but for the feature, this must be renamed or removed.


Related:

fixes #148


Want to use this right now?

in composer.json add

 "repositories": [
        {
            "type": "vcs",
            "url" :  "https://github.com/Saifallak/laravel-theme.git"
        }
    ],

Quick note for testing

you need to php artisan optimize:clear after changing this config value (idk why, but somehow laravel caches blade directives by itself, so if it was enabled, you need to clear cache and it won't be registered again)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

conflict with laravel @js helper
1 participant