Skip to main content

Compressing css and js files in the console using yui-compressor



A little distracted from the topic of server administration and using Debian to develop the site. :)

Compressing css and js files saves traffic. This is especially true for mobile phones, where the speed is usually low. In this, we can provide invaluable assistance to the yui-compressor, which is available for installation from Debian repositories.



Install yui-compressor

  # aptitude install yui-compressor 

It is necessary to work with the compressor on behalf of the simple user. All commands are executed in the console.

Called as follows: we write the command yui-compressor, then with the option -o specify the final file, and after - the source one, which requires compression.



Compress css styles

  $ yui-compressor -o style.min.css style.css 

Compression scripts

  $ yui-compressor -o script.min.js script.js 

You can explicitly specify the type of compressible file with the option --type , the encoding of the source file --charset . The specific option --nomunge designed to disable obfuscation of scripts.



If the final file is not specified, the result of the command execution will be displayed on the screen.



How do you rate the article?
Звёзд: 1Звёзд: 2Звёзд: 3Звёзд: 4Звёзд: 5 (No ratings yet)
Loading...

Add a comment

Your email will not be published.