HTMLMin / Laravel-HTMLMin

A simple HTML minifier for Laravel 5, 6, 7, 8 & 9.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What rules do blade need to compy to work? And is it possible to debug ?

dionmes opened this issue · comments

commented

If I enable HTMLMin in my app, it doesn't do much. If I force it, the app does not work anymore. So that is where I am stuck.... I see no possibility to debug or tune. For example; for me only removing comments and spacing would already help, now its just all or nothing and with all (force) it breaks the app? Any possibility or info on how to get it working without breaking or debugging to get result without forcing it?

Have you clear the views cache ?
php artisan view:clear

commented

Hi, thanks for the response. Yes I have, and when I enable 'force' it corrupts the output, so I know it is working. However, when I disable 'force' the app works but does nothing.

Wich version of laravel do you used ?
Juste installed on a fresh install of 5.5, provide those:
providers : HTMLMin\HTMLMin\HTMLMinServiceProvider::class,
aliases : 'HTMLMin' => HTMLMin\HTMLMin\Facades\HTMLMin::class,

Publish it via php artisan vendor:publish then change only 'blade' => true,

Used of course a composer dump-autoload

commented

I have installed it like you described although I am now on Laravel 5.4 and in the process of upgrading to 5.5. I will let you know when I am on 5.5.

commented

Upgraded to 5.5 and its now even worse, force does nothing anymore. I registered HTMLMin in the config/app.php, did a couple of times vendor:publish and composer dump-autoload . But nothing, force or no force. I remove the HTML requirement from the composer file ("htmlmin/htmlmin": "^5.6" ) and than I get the message my app.php needs it. So I know its getting loaded, but without any result.

I have this in my composer.json

"require": {
        "php": ">=7.0.0",
        "fideloper/proxy": "~3.3",
        "htmlmin/htmlmin": "^5.6",
        "intervention/image": "~2.4.1",
        "laravel/framework": "5.5.*",
        "laravel/tinker": "~1.0",
        "ovh/php-ovh-sms": "dev-master",
        "predis/predis": "^1.1",
        "weblee/mandrill": "dev-master"
    },
    "require-dev": {
        "filp/whoops": "~2.0",
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "~1.0",
        "phpunit/phpunit": "~6.0",
        "symfony/thanks": "^1.0",
        "barryvdh/laravel-debugbar": "dev-master"
    },

And in the htmlmin.php
'blade' => true,

Noting more

commented

Copy pasted that json config in the composer file, did the dump-autoload, vendor publish etc But no result. I got some extra stuff at the end of the webpage and of course some things didn't;t work anymore. But still no minifying.

The biggest issue is that there is no debug possibility at all. I don't know what is happening although I know HTMLMin is loaded.

Could you copy paste your composer and config ? Maybe I can find the way while reproduce it :)

commented

Sure, I am already very happy that you are trying to help.

`{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.6.4",
        "anhskohbo/no-captcha": "2.*",
        "aws/aws-sdk-php": "^3.52",
        "firebase/php-jwt": ">=5.0",
        "htmlmin/htmlmin": "^5.6",
        "laravel/framework": "5.5.*",
        "laravel/socialite": "^3.0",
        "laravel/tinker": "~1.0",
        "league/flysystem-aws-s3-v3": "^1.0",
        "mpratt/embera": "~1.0",
        "predis/predis": "^1.1"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.7"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "Eligo\\": "app/"
        },
	"files": ["app/Eligo/eligo_constants.php"]
    },
    "autoload-dev": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}

I am running php 7.1.15

Try this :

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=7.0.0",
        "anhskohbo/no-captcha": "2.*",
        "aws/aws-sdk-php": "^3.52",
        "fideloper/proxy": "~3.3",
        "firebase/php-jwt": ">=5.0",
        "htmlmin/htmlmin": "^5.6",
        "laravel/framework": "5.5.*",
        "laravel/socialite": "^3.0",
        "laravel/tinker": "~1.0",
        "league/flysystem-aws-s3-v3": "^1.0",
        "mpratt/embera": "~1.0",
        "predis/predis": "^1.1"
    },
    "require-dev": {
        "filp/whoops": "~2.0",
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "~1.0",
        "phpunit/phpunit": "~6.0",
        "symfony/thanks": "^1.0",
        "barryvdh/laravel-debugbar": "dev-master"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}

Edit: add your package inside

commented

The result :(

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 0 removals
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover
PHP Fatal error: Uncaught ReflectionException: Class Eligo\Console\Kernel does not exist in /var/www/eligo_dev01/vendor/laravel/framework/src/Illuminate/Container/Container.php:752

Ok. Check If you have a php >=7.1 and try with a fresh install.

Hello @dionmes , are you using this package yet?

commented

Hi @garbinmarcelo , no. I actually moved away from php completely.