Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

template minification

posted by dejan 8 years ago

having problems using minification, tried everything that i found in the docs and in discussion. but, let's start from the beginning:

ok, i came up to this:


    $template->enableMinification('development',
                                  $_SERVER['DOCUMENT_ROOT'] . '/mincache/',
                                  $_SERVER['DOCUMENT_ROOT'] . '/flourishTest/'
    );

and placed css/js files in the html doesn't have relative paths: <link rel="stylesheet" type="text/css" href="C:/xampp/htdocs/mincache/236971c09871d0f9cc9438d48b5c35114a3ceb55.css?v=1307457752" media="all" />

i have tried using fFilesystem::addWebPathTranslation(), but w/o success.

any hints?

posted by dejan 8 years ago

No, files with a length of zero would not be normal, unless all of your files you are adding are empty. :-) I presume that was related to the third parameter. I will look at the docs and try to make it clear how the third parameter relates to non-absolute CSS and JS paths.

My guess for the reason it is not working is the forward slashes in the second parameter. It looks like fTemplating is not using realpath() on the second parameter, so slashes are staying as forward slashes, while the canonical versions on windows use backslashes \\. I have a feeling this is throwing off the string replacement done by fFilesystem::translateToWebPath().

Try using this code and let me know if it works:

$template->enableMinification('development',
                                  realpath($_SERVER['DOCUMENT_ROOT'] . '/mincache/'),
                                  $_SERVER['DOCUMENT_ROOT'] . '/flourishTest/'
    );
posted by wbond 8 years ago

Yep, it works. :)

Thanks!

posted by dejan 8 years ago

This should be fixed in r1034.

posted by wbond 8 years ago