Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will the order of minify and concatenate make difference for batch of JavaScript/CSS files?

To reduce http requests and minify static files download, it is recommended to concatenate and minify all JavaScript/CSS files used by single page.

Does it make difference?

1) Minify all javascript files and then concatenate them;

2) Concatenate all javascript files and then minify them.

like image 388
Morgan Cheng Avatar asked Jul 16 '11 13:07

Morgan Cheng


People also ask

Why do we need to minify JavaScript?

Minification is the process of minimizing code and markup in your web pages and script files. It's one of the main methods used to reduce load times and bandwidth usage on websites. Minification dramatically improves site speed and accessibility, directly translating into a better user experience.

How do you minify a JavaScript file?

To minify JavaScript, try UglifyJS. The Closure Compiler is also very effective. You can create a build process that uses these tools to minify and rename the development files and save them to a production directory.

Should I compress JavaScript?

It is important to minify your CSS and minimise JavaScript files so they can load faster on your web pages. There are many reasons why you should minify your CSS and JavaScript: Reduce file size: The more code there is in a file, the larger it will be. Minified code is usually much smaller than the original version.

What is JavaScript Minification process?

Minification, also known as minimization, is the process of removing all unnecessary characters from JavaScript source code without altering its functionality. This includes the removal of whitespace, comments, and semicolons, along with the use of shorter variable names and functions.


1 Answers

Minifying several smaller files into one big file (through >> redirect, for example) appeals by the fact that good minifyers will complain if they find a syntax error in one of those files. You will immediately see in which file.

like image 100
katspaugh Avatar answered Oct 20 '22 01:10

katspaugh