JS compression of Phalcon resource management

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.