Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between concat and uglify and minify?

What's the difference between concat, uglify, and minify tasks in grunt? I set up an uglify task for all of my site's javascript tasks, and it seemed to both minify and concatenate them. Grunt's site has a great description for how to configure each task, but it doesn't seem to explain what each task actually does.

like image 527
mheavers Avatar asked Oct 30 '13 21:10

mheavers


People also ask

What is the difference between concatenation and minification?

Minification strips those elements. So the point of minification is reduce the file size of your CSS and Java Script assets so that they download quicker. Concatenation means to join together. If you have 7 CSS files on your site, concatenation will combine them into less files, maybe 2 instead of 7.

What is Uglify used for?

Uglify JS is a JavaScript library for minifying JavaScript files. To 'uglify' a JavaScript file is to minify it using Uglify. Uglification improves performance while reducing readability. Encryption: This is the process of translating data, called plain data, into encoded data.

What is the point of minify?

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.

What is Uglify in Gulp?

gulp-uglify emits an 'error' event if it is unable to minify a specific file. The GulpUglifyError constructor is exported by this plugin for instanceof checks. It contains the following properties: fileName : The full file path for the file being minified. cause : The original UglifyJS error, if available.


1 Answers

  • Concatenation is just appending all of the static files into one large file.

  • Minification is just removing unnecesary whitespace and redundant / optional tokens like curlys and semicolons, and can be reversed by using a linter.

  • Uglification is the act of transforming the code into an "unreadable" form, that is, renaming variables/functions to hide the original intent... It is, also, irreversable.

like image 150
diclophis Avatar answered Oct 16 '22 16:10

diclophis