简体   繁体   English

Are.min.js /.min.css 文件加载/解析不同?

[英]Are .min.js / .min.css files loaded / parsed differently?

I've minified all of my Js and Css scripts and stylesheets, respectively, but deployed them on my site as.js and.css files, respectively.我已经分别缩小了我所有的 Js 和 Css 脚本和样式表,但分别将它们部署在我的网站上作为 .js 和 .css 文件。 A colleague now told me that it's better to store their names using the .min prefix, as this will be processed differently by the browser, and for example Google will improve the ranking of your page, as it will assume faster page load times.一位同事现在告诉我,最好使用.min前缀存储他们的名字,因为这将由浏览器以不同方式处理,例如,谷歌将提高您页面的排名,因为它假设页面加载时间更快。

I cannot find anything online is this sense;我在网上找不到任何东西是这种感觉; so I wanted to ask here: Is this actually true?所以我想在这里问:这真的是真的吗?

.min.js is a standard used for "minified" versions of a JavaScript file. .min.js 是用于 JavaScript 文件的“缩小”版本的标准。

Google doesn't cares about whether the file itself contains ".min.js" but creating a minified version of the script greatly reduces the size of the file which then reduces the bandwidth required to load the page. Google 并不关心文件本身是否包含“.min.js”,但创建脚本的缩小版本会大大减小文件的大小,从而减少加载页面所需的带宽。 This is what Google cares about for its rankings.这就是谷歌关心的排名。

Google will not parse differently if the minified version is used.如果使用缩小版本,Google 将不会进行不同的解析。 But using minified will have advantages on your application.但是使用 minified 会对你的应用程序有好处。

  • It will drastically reduce loading times and bandwidth usage on your website.它将大大减少您网站上的加载时间和带宽使用。
  • It also improves site speed and accessibility, directly translating into a better user experience.它还提高了网站速度和可访问性,直接转化为更好的用户体验。

For example:例如:

jquery.min.js : this is the minified version of jQuery. Ie .min.js jquery.min.js :这是 jQuery 的缩小版本。即.min.js

jquery.js : this is the regular version of jQuery. jquery.js :这是 jQuery 的普通版本。

Basically the functionality is exactly the same except the readability hence better use minified version in your PROD environment and keep regular version for debugging purposes.基本上,除了可读性之外,功能完全相同,因此最好在PROD环境中使用minified版本,并保留常规版本以进行debugging

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM