Open flo-sch opened 7 years ago
Hi @flo-sch,
Thanks, nice you're interested in this project. I don't really understand what you mean with standalone? Without any Laravel dependencies? As described in the readme you can use it with composer for plain php projects without frameworks if you want that.
I tried to create this minifier with multi framework support in mind. So it should be possible to integrate this project into Symfony too.
I used Illuminate\Support\*
out of laziness ;). It isn't a big problem to replace those but I don't really understand why you want that?
You want to move the ServiceProviders out of this repo and you suggest to create a separate HtmlMinifierLaravel repo?! Possible, but I don't see the value of that right now? Is it needed for Symfony integration (not really a Symfony developer)? I thought it was nice to just have one project with all the source code in mind so you can use it in any project (sure, there is overhead in the sense that you don't need certain source files).
I'm open to pull requests and suggestions. Can you answer those questions so we can talk further about how we want to address some issues?
Hi @ArjanSchouten, thanks for taking the time to answer :)
Short story, currently:
"arjanschouten/htmlminifier": "dev-master"
=> requires "illuminate/filesystem": "5.1.*|5.2.*"
=> requires "symfony/finder": "2.8.*|3.0.*"
Which means I can't use this minifier in a Symfony project using Symfony >= 3.1, for instance 3.3.8 (which I do).
It is obviously easily fixable just by updating the composer version of arjanschouten/htmlminifier
, as illuminate/filesystem
5.5 for instance requires symfony/finder
3.3.
But IMHO this would be a never ending issue, each time one framework dependency would have dependencies updates, the story would start again, which is my main argument for relying in framework-agnostic (or in my case, symfony-dependent plugins). Doesn't bring a big value to Laravel projects for now, but way easier to maintain, the way I see it.
I already started to play a bit and came with a laravel agnostic version of the minifier, without any big problem, Laravel\Support
is indeed easy to replace with native PHP methods (even though I totally get the point of using such helpers within a Laravel project).
Then I was able to use this minifier to minify the output of a symfony Response
object.
However, minifying output at runtime is not extremely interesting for me, and working on the templates themselves makes more sense to me, cause it could be done once at deployment, using a command, and actually increase rendering performances.
I just need to find out what's the best way to handle this with Twig (Symfony default template engine), which code source I'm not that confident with yet, but I'm close to be able to show you what I've done :)
What do you think of my a framework-agnostic argument?
As the laravel-specific integrations are already built, I guess "isolating" them in a specific repository with laravel dependencies should be quite easy to do, and as you authored this project, keeping such repositories under your name seems fair, but I'm just proposing, decision is all yours :)
I understand the dependency problem. I agree that the Laravel integration can be moved to another repository. By doing that we can skip all the Illuminate
dependencies if needed in this repo. So we create another repo LaravelHtmlMinifier
. We put all Laravel code there. I will fix that if you're ok with that. Btw, I don't want complex/too much copied code in the codebase if there is a library to handle that. Since Symfony is following semver I don't mind using Symfony or other dependencies.
We have to change some code in this repo. Can we discuss about who is going to do what (you have already did something)?!
Can I leave the symfony/silex to you? You said you have already implemented something? Are you going to create a repo for that?
Hey @ArjanSchouten,
I have already replaced the few Illuminate\Support\Str
and Illuminate\Support\Collection
dependencies by native PHP methods, if you create a repository for the codebase, I can make a pull request to show you what I've done so far, and we can discuss and improve it using libraries or whatever if you prefer, no problem for me.
I have also already built a working Symfony integration for the Twig templating engine, and I can work on a Silex integration aswell without problem :) Would you like me to create those repositories?
Alright. I'm working on the Laravel part. I first move the Laravel stuff out of the repository.
You can make the Symfony repo if you want.
Btw I started this project as a small side project. I will make things to work for now but don't know how long I support it. Depends on how it currently compares to other minifiers and their ease of use/minification ratio etc.
@flo-sch, I've moved the Laravel source code out of this repo to https://github.com/ArjanSchouten/LaravelHtmlMinifier.
I just did a quick test and verified the most basic use case on Laravel 5.5. Have to do some additional work but I think that the minifier can work for you if the Laravel dependencies are deleted. I can review a PR with Laravel deps removing if you want to send one.
Great :)
I'll create a PR max. monday then!
Hey @ArjanSchouten,
I am actually looking for a PHP standalone HTML minifer to use in several projects. Just found out yours, which seems to be a very great job, thanks a lot for your effort!
I am personally more a Symfony developer than Laravel, and I was wondering if porting a standalone version of this minifier (I mean, framework-agnostic) would be something that could interest you?
The way I see it, the plan would be to first port a version of this project without any framework dependency, by removing the
Illuminate\Support\*
dependencies of the source code (such asStr
andCollection
+ the laravel-specific ServiceProviders and artisan Commands (+ blade placeholders etc.)Then, build some framework-specific integrations such as Laravel, Lumen, Symfony, Silex (or any other framework if anybody wants to provide a new integration), in external packages which would rely on the standalone one?
I would be ready to work on this of course (I don't think it requires a lot of time), but I prefer to kindly ask you first, if this makes sense for you, if you would be interested in extending your project in this way / helping for instance with the Laravel/Lumen integrations, or if you prefer to stay out and keep things as they are for you?
I'll wait a few days see if you're interested in any way :) Best regards!