dactivo / Bolt.cm-HTML-minifier

This extensions minify HTML only in the frontend part
MIT License
5 stars 0 forks source link

Also compresses images #2

Open madc opened 8 years ago

madc commented 8 years ago

It seems, the extension also compresses images that are processed by Bolt.

In my case, I had to extend Extension.php a bit:

[...]
if($this->getExtension($request->getPathInfo())!=".css" && 
$this->getExtension($request->getPathInfo())!=".js"  && 
$this->getExtension($request->getPathInfo())!=".jpg")
[...]

This is just a quick fix for .jpg, but I#m sure there is a more generic solution to this issue.

dactivo commented 8 years ago

Yes I saw that, and as a quick fix, I added the extensions css and js, because the filter $this->app->after receives any file / request.

I have found a better solution, I think: if($this->getExtension($request->getPathInfo())=="")

Because html is what the plugin compresses, and no extension response to the page request. I don't know any other method to verify this in silex / bolt.cm.

What do you think about?

madc commented 8 years ago

But wouldn't this fail, if you have routes suffixed with '.html'?

dactivo commented 8 years ago

Bolt.cm does not add this suffix, no?

madc commented 8 years ago

Not by default, no. But is should be possible to archive such a link by modifying the routing setup.