README in web_resource_bundler-0.0.13 vs README in web_resource_bundler-0.0.14
- old
+ new
@@ -3,10 +3,11 @@
Content:
1. Purpose
2. Functional description
3. Installation
4. Usage
+5. Recommendations
=================== 1. Purpose ===============================================
The main purpose of WebResourceBundler gem is to minimize request & response
round-trips count. This could be done by bundling particular resource (css or js) in
@@ -96,23 +97,47 @@
use <%= web_resource_bundler_process do %>
And as result you'll have
-
<link href="/cache/base64_style_d880a502addaa493b889c0970616430b.css?1290594873" media="screen" rel="stylesheet" type="text/css" />
<script src="/cache/script_275d311037da40e9c9b8c919a8c08b55.js?1290594873" type="text/javascript"></script>
<!--[if lte IE 7]>
<link href="/cache/base64_ie_style_d880a502addaa493b889c0970616430b.css?1290594873" media="screen" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if lte IE 7]>
- <link type="text/css" rel="stylesheet" href="/cache/base64_style_ad801w02addaa493b889c0970616430b"/>
+ <link type="text/css" rel="stylesheet" href="/cache/base64_style_ad801w02addaa493b889c0970616430b.css?1290594873"/>
<![endif]-->
!!!
Don't forget to clean your cache directory after deploy to clean old bundles
To disable bundling and see raw results add no_bundler param
mysite.com/?no_bundler=1
+================= 5. Recommendations ===================================
+
+1. Be mindful while organazing and linking your resource files
+WebResourceBundler combines all resource file in one. This resulted file could be huge.
+ a. Don't link all resources in layouts!
+ Be sure to link resources (css\js) only for pages that using them, in other case your users will be forced
+ to download huge css\js files with unused content.
+ b. One css for one page.
+ Try to slice you css files - separate file for each particular page.
+ c. Separate bundle block for crucial resources
+ To make crucial resources (basic styles\scripts for user can see basic page layout ASAP) load first - just bundle them in separate web_resource_bundler_process block and put this block at the top of your head block.
+
+2. Don't set max_image_size to big values.
+The main reason of using Base64 filter is to avoid unnecessary server requests and minimize load time,
+but when encoded image is very big, traffic overhead time (encoded image base64 code is bigger for apprx. 30% than source image size) could be bigger than request time. In this case your site could be even slower than without a WebResourceBundler.
+Recommended max_image_size value is 1..20kbytes
+
+3. Be careful with third party scripts.
+Some third party javascript libs can load another script file on the fly, relative path for this file computed
+on the client side. But your scripts are bundled and their relative path changed (cache folder), that's why such script
+won't be able to compute loaded file path correctly. You should avoid bundling such tricky javascripts.
+
+4. Unexistent resources handling
+ a. Be sure to link in html only existent resource files, otherwise bundler won't work.
+ b. If you have unexistent images in css, bundler will work but you've got info messages in log.