Windows Symfony2 installation of UGLIFYJS2 and UGLIFYCSS

Source: Internet
Author: User

Uglifyjs is a JavaScript parser/compressor/beautification tool. It can be used to combine and shrink multiple JavaScript resources, making them require fewer HTTP requests and making your site load faster. uglifycss is a CSS compressor/beautification tool that works similarly to UGLIFYJS.


How to install under Windows:

1. Installing Nodejs and NPM tools

Because Nodejs comes with NPM tools, it is possible to install Nodejs directly.

Open http://nodejs.org/, click Install in the webpage, download the corresponding MSI file and install


2. Enter your Symfony2 root directory in cmd

CD E:\xampp\htdocs\symfony

3. Install Uglify-js and uglifycss to your App/resources/node_modules directory

NPM Install uglify-js--prefix app/resourcesnpm install uglifycss--prefix app/resources

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4B/C2/wKioL1Qx9-LhblAqAADtaHnf4-I699.jpg "title=" Qq20141006095958.png "alt=" Wkiol1qx9-lhblaqaadtahnf4-i699.jpg "/>

4, Configuration Symfony

# app/config/config.ymlassetic:bundles: [Acmedemobundle] # [] is your bundle name node: "D:\Program Files\nodejs" # your Nodejs installs the path filters:uglifyjs2:bin: "%kernel.root_dir%/resources/node_modules/.bin/uglifyjs. CMD "#npm安装的路径 uglifycss:bin:"%kernel.root_dir%/resources/node_modules/.bin/uglifycss.cmd "


5. Use:

{% stylesheets ' bundles/acmefoo/css/* ' filter= ' uglifycss ' filter= ' cssrewrite '%} <link rel= "stylesheet" href= "{{as Set_url}} "/>{% endstylesheets%}


{% javascripts ' @AcmeFooBundle/resources/public/js/* ' filter= '? Uglifyjs2 '%} <script src= ' {{asset_url}} ' ></ script>{% endjavascripts%}



Reference: http://symfony.com/doc/current/cookbook/assetic/uglifyjs.html

This article is from the "Tech Tech" blog, so be sure to keep this source http://baoniu.blog.51cto.com/9450787/1560785

Windows Symfony2 installation of UGLIFYJS2 and UGLIFYCSS

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.