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
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 音乐压缩软件
PDF Shrink是一个PDF文件体积压缩器,生成的文件大小适合作为电子邮件附件或在手机屏幕上阅读。PDF Shrink还可以进行文件压缩以减少生PDF文件的大小。
这个程序是为了实现图片(包括彩色图和灰度图)的放缩功能,能满足任意指定放缩倍数或任意目标尺寸,原理是依据双线性插值。
这是一个基于Matlab平台实现的图像放缩的代码,可以实现任意倍数,任意指定尺寸的放缩要求。原理是基于最近点近似。
0.13um-shrink工艺的嵌入式闪存的耐久性特性研究_V2.0.zip
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 ...
前端开源库-shrink-ray-current收缩光线流,node.js压缩中间件,支持brotli和zopfli
DVD影片备份工具(DVD Shrink) 3.20 绿色汉化版
可将PDF压缩。一般办公网络传输 压缩50%-80%
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 ...
这个工具很好的压缩了数据库日志文件的大小。 操作简单,输入服务器名,帐号密码,数据库名就OK。
0.13um-shrink工艺的嵌入式闪存的耐久性特性研究_V2.0 字数.zip
PDF 专用压缩软件 PDF shrink
JavaScript
// `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 ) ...
* the cursor was not painted if DoubleBuffered was set to true for the parent of the editor + WPTools Premium: Saves and loads \column * improved theming of TWPToolbar and TWPToolPanel + new event: ...