Like it or not, JavaScript has become the heaviest asset on modern
webpages. Long gone are the days of waiting for large images to load,
now we wait for fancy effects libraries, re-tweet counters, and cornification
.
When you load Twitter, Yahoo, or Google docs, almost half the data
you load will be JavaScript. Below is an asset breakdown for
docs.google.com.
Users Hate to Wait
After download JavaScript files need to be evaluated as well. The
greater the complexity and size of the JavaScript the greater the load
time and frustration of your users.
Users hate waiting for pages to load, and if most of that time is
spent loading JavaScript then reducing the amount of JavaScript is the
easiest way to turn that hate into love.
You probably already know this, but you haven't done it yet because
it can be a major pain. Odds are most of your JavaScript weight (file
size) is in large libraries that need to be included on any page that
uses a single function from that library. You could try and split them
into smaller libraries but then you would have to manage all the
dependencies.
Less JavaScript Without the Hassle
What if there was an application that could automatically determine
what functions you don't need and removed them for you? It turns out
that Google released just such an application last week.
The Google Closure Compiler goes a step beyond minification. Rather
then just remove spaces, comments and line feeds, it renames variables
and functions to use less characters and will completely remove
functions that you don't need.
Even if you are not using unobtrusive JavaScript (shame on you), you
can add a bit of code to tell the compiler not to rename certain
functions that are referenced from your XHTML files.
Effortless Work Flow Integration
We got so excited about the Compiler here at ZURB that we wrote a
Rails plugin that integrates it with the standard Rails deployment work
flow.
There were two issues we needed to resolve:
- Once you compile a JavaScript file it becomes damn near impossible to read and edit.
- Compiling all your JavaScript files together so the the compiler can properly determine what functions to remove.
It turns out Rails has build in functionality to combine and cache
JavaScript files to minimize the number of http requests and improve
the effectiveness of gzip compression. Our plugin hooks into that
functionality and runs the combined files through the compiler before
caching them. This allows us to mix and match our JavaScript libraries
and have a single compiled file containing only the functions we need.
In our development environments the JavaScript files are linked
individually allowing us to debug using the original source code.
分享到:
相关推荐
js缩小 辅助javascript缩小器。 缩短字符串文字,属性名称,变量名称,内置... all : false , // shrink everything (enables all of the below options, in case they aren't enabled by default - they are) literal
本文将深入探讨“shrink_zoom_bilinear.zip_bilinear shrink_zoom”这一程序,该程序专门用于实现图像的缩放操作,尤其是基于双线性插值的算法。 双线性插值是一种在二维空间中进行数据插值的方法,广泛应用于图像...
Capture and store still and video images with HighGUI Transform images to stretch, shrink, warp, remap, and repair Explore pattern recognition, including face detection Track objects and motion ...
The advent of LSB 2.0 is revolutionary in that it allows ISVs to create "shrink-wrapped software" for the Linux platform much in the same way they already do for Windows. Written by the team that ...
1.领域:matlab,Shrink小波变换算法 2.内容:基于Shrink小波变换的数据去噪可以设置硬阈值和软阈值+代码操作视频 3.用处:用于Shrink小波变换算法编程学习 4.指向人群:本硕博等教研学习使用 5.运行注意事项:...
WinMP3Shrink是一款专为音乐爱好者设计的MP3压缩软件,它可以帮助用户有效地减小音频文件的大小,尤其适用于那些存储空间有限或者希望节省网络传输时间的用户。这款工具的核心功能是通过降低音频质量来实现文件的...
**Brotli** 是Google开发的一种新的压缩算法,相比传统的Gzip,它在压缩率上有所提升,特别是在HTML、JavaScript和CSS等Web常见文件类型上表现更优。Brotli的优势在于它能够提供更好的压缩比,同时在解压速度上也...
PDF Shrink是一款专门针对PDF文件进行压缩的软件,它的主要功能是减小PDF文件的大小,以便于在办公环境中更方便地进行网络传输、存储或分享。PDF文件因其高质量的显示效果和丰富的交互性,被广泛应用于各种文档的...
- 作为不及物动词时,可以用于表达某物自发性地收缩,如 "The flowers will shrink in the frost."(花朵会在霜冻中萎缩。) 3. **过去分词** - "shrink"的过去分词可以用作形容词,如 "The shrunken sweater ...
《DVD影片备份工具——DVD Shrink 3.20 绿色汉化版详解》 在数字媒体领域,DVD影片备份是一项重要的需求,以保护珍贵的电影收藏免受物理损坏或丢失。DVD Shrink是一款非常实用的软件,专门用于备份和压缩DVD影片,...
这是一个基于Matlab平台实现的图像放缩的代码,可以实现任意倍数,任意指定尺寸的放缩要求。原理是基于最近点近似。
0.13微米缩小工艺(0.13um-shrink)是半导体制造技术中一个重要的里程碑,它代表了从更传统的微米级别工艺向纳米级别工艺过渡的关键步骤。在这个阶段,芯片上的晶体管尺寸被进一步减小,从而提高了集成度、性能和...
for the diskette sold in conjunction with the book will be about $20. BACKGROUND Much excitement exists due to the apparent ability of artificial neural networks to imitate the brain's ability ...
IDE Fix Pack is a collection of unofficial bug fixes and performance optimizations for the RAD Studio IDE, Win32/Win64/Andoird-ARM compiler and Win32 debugger. ------ Installation: 1. Start ...
本文将深入探讨0.13um-shrink工艺对嵌入式闪存耐久性特性的影响,旨在理解这种工艺如何影响闪存的寿命和可靠性。 嵌入式闪存的耐久性特性主要体现在两个方面:编程/擦除循环次数(P/E cycles)和数据保留时间。0.13...
本项目"Thumbnails Shrink and Grow Effect in jQuery.zip"显然关注的是如何利用JavaScript及其库jQuery来实现一种缩放效果,即缩略图的“脉冲”效果。这种效果常见于网站的图片展示区域,可以吸引用户的注意力,...
PDF Shrink是一个PDF文件体积压缩器,生成的文件大小适合作为电子邮件附件或在手机屏幕上阅读。PDF Shrink还可以进行文件压缩以减少生PDF文件的大小。
这个工具很好的压缩了数据库日志文件的大小。 操作简单,输入服务器名,帐号密码,数据库名就OK。
PDF Shrink是一款专门针对PDF文件进行压缩的软件,它的主要功能是减小PDF文件的大小,以便于存储、传输和分享。在处理大型或包含大量图像的PDF文档时,PDF Shrink能有效地降低文件占用的磁盘空间。下面将详细介绍这...
// `decompress` takes that base64 string and returns the original unicode string const thing = async ( s = '' ) => { const shrunk = await compress ( s ) const expanded = await decompress ( shrunk ) ...