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

CSS And JS is not working then including a middleware #10

Open
kidsminnie opened this issue Jan 26, 2024 · 3 comments
Open

CSS And JS is not working then including a middleware #10

kidsminnie opened this issue Jan 26, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@kidsminnie
Copy link

I am facing a problem in this package, the problem is after minifying files the style is not implemented on any tag
include file link, with this package javascript is also not working.

@fahlisaputra
Copy link
Owner

Can you show the code snippet to call the minify() function on the blade view?

And maybe you need to clear the cache, try running php artisan optimize

@fahlisaputra fahlisaputra added the question Further information is requested label Feb 14, 2024
@kidsminnie
Copy link
Author

` protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,

   \Fahlisaputra\Minify\Middleware\MinifyCss::class,
    // Middleware to minify Javascript
    \Fahlisaputra\Minify\Middleware\MinifyJavascript::class,
    // Middleware to minify Blade
   \Fahlisaputra\Minify\Middleware\MinifyHtml::class,
];`

I am including middleware just like above.
After this doing html is minified and js , css is also minified but the problem is JS is not working. I am using Alpine.js
including in blade file as you mention in your code sinppet.

@fahlisaputra
Copy link
Owner

I'm sorry, Minify for Laravel has not been tested directly on several Javascript frameworks such as Alpine.js, Vue, etc. at this time.

As a first solution, you might be able to change the configuration in the auto insert semicolone section, please see the readme file to change the default value.

"insert_semicolon" => [
    'css' => env("MINIFY_CSS_SEMICOLON", true),
    'js' => env("MINIFY_JS_SEMICOLON", true),
],

after you changed the value, please run php artisan optimize

This feedback means a lot to me. Hope Minify for Laravel can be used in various frameworks in the future.

@fahlisaputra fahlisaputra added enhancement New feature or request and removed question Further information is requested labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants