0

Do both these files have the same content? Or do they provide different functionality so we need to include both of them? I'm new to jQuery so would like to know. Thanks.

1
  • 1
    Note that you will run into this naming convention a tonne as you grow into JavaScript development. You will probably eventually use it yourself as you minify your own custom scripts. Commented Mar 30, 2012 at 18:54

5 Answers 5

6

The contents are NOT same, but the functionality is same and You should include only one of them.

jquery-1.7.1.js -> This is the actual version of the script which will be used by developers. Ideal for development environment.

jquery-1.7.1.min.js -> This is the minified version of the actual script(something like compression) ideally used in QA/Production environment.

Read about minification and its benefits -> http://www.alistapart.com/articles/better-javascript-minification/

Sign up to request clarification or add additional context in comments.

3 Comments

The contents of the files are not actually the same, but their behavior as a script is the same.
whats the difference between both
@Kaipa, well, for example locals are renamed and some constructs are changed in minified files, so the actual source code is different. This is, however, done very carefully in order for the resulting script to behave exactly the same as the original.
6

No. They are the exact same and you should only include one.

The .min ("minified") version is intended for production usage, as it is much smaller (the comments, whitespace, etc. have all been stripped out). The non-minified version is helpful for debugging but has a much bigger file size.

Comments

4

The .min version is a minified version of the one without the .min.

They do they same thing.

Comments

4

They have the same exact functionality.

The 'min' file has all unnecessary characters removed to make the file size smaller but keep the same functionality.

Comments

0

The one that ends with .min.js is the compressed version which uses less disk space, you should use that one.

1 Comment

Just to clarify, the goal of minification is not really to save disk space (disk space being quite cheap these days), it's because a smaller file results in a faster download, and therefore a better experience for the end users whose browsers do not already have your script in cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.