Home >Web Front-end >JS Tutorial >How to compress javascript with Microsoft Ajax Minifier_javascript tips

How to compress javascript with Microsoft Ajax Minifier_javascript tips

WBOY
WBOYOriginal
2016-05-16 18:33:081224browse

But the commonly used command is ajaxmin -a -h inputfile.js -o outputfile.js (this is a high compression method)

clip_image002

You can also analyze JS code. The command is ajaxmin inputfile.js -a -w:3

clip_image004
For more usage methods, please refer to the Help instructions.
ajaxmin.exe Download Microsoft AJAX library (sixth preview version)
When Ajaxmin compresses multiple files:
Ajaxmin —inputfile_1 —inputfile_2 —o —oututfile /Eo:utf- 8 /Ei:utf-8
where
/Eo:utf-8 /Ei:utf-8 represents the input and output format. If not specified, the default ASCII code is used.
While asking for advice, my brother wrote a program to execute the Ajaxmin program:
The code is as follows:

Copy the code The code is as follows :

public void ExecuteCommond(List inputfileLis, string outfile)
{
for (int i = 0; i < inputfileList.Count; i )
{
CompressCode = inputfileList[i] ” ”;
}
CompressCode = " -o " outfile " /Eo:utf-8 /Ei:utf-8";
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = @"C:Program FilesMicrosoftMicrosoft Ajax Minifierajaxmin.exe";//The name of the program that needs to be started
p.StartInfo.Arguments = CompressCode;/ /Start parameters
p.Start();//Start
}

This is faster than entering commands manually
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn