Write the website program is known JS compression can reduce the server's demand for bandwidth compared to the non-compression
Today we look at Phalcon is if the compression JS
Look at the code:
$this->assets->collection (' Jsheader ')->settargetpath (' Js/jquery-1.11.1.min.js ')->setTargetUri (' js/ Jquery-1.11.1.min.js ')->addjs (' Js/jquery-1.11.1.js ', True, True)->addfilter (new phalcon\assets\filters\ Jsmin ());
The first line generates a collection named Jsheader. Then the original Jsheader was just an identity.
The second line sets the target directory where the resulting compressed files are placed
The third line sets the URI of the compressed JS
The line four sets the JS to compress
Row five sets the compression tool used
Here's how to use it:
$this->assets->outputjs (' Jsheader ');
Use the above directly in the view
JS compression of Phalcon resource management