web_resource_bundler 0.0.22 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/Readme.md +7 -5
- data/lib/web_resource_bundler/railtie.rb +15 -4
- data/rails/init.rb +2 -0
- metadata +4 -3
data/Rakefile
CHANGED
data/Readme.md
CHANGED
@@ -105,12 +105,13 @@ Recommendations
|
|
105
105
|
|
106
106
|
1. Be mindful while organazing and linking your resource files
|
107
107
|
WebResourceBundler combines all resource file in one. This resulted file could be huge.
|
108
|
-
|
108
|
+
|
109
|
+
* Don't link all resources in layouts!
|
109
110
|
Be sure to link resources (css\js) only for pages that using them, in other case your users will be forced
|
110
111
|
to download huge css\js files with unused content.
|
111
|
-
|
112
|
+
* One css for one page.
|
112
113
|
Try to slice you css files - separate file for each particular page.
|
113
|
-
|
114
|
+
* Separate bundle block for crucial resources
|
114
115
|
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.
|
115
116
|
|
116
117
|
2. Don't set max_image_size to big values.
|
@@ -124,5 +125,6 @@ on the client side. But your scripts are bundled and their relative path changed
|
|
124
125
|
won't be able to compute loaded file path correctly. You should avoid bundling such tricky javascripts.
|
125
126
|
|
126
127
|
4. Unexistent resources handling
|
127
|
-
|
128
|
-
|
128
|
+
|
129
|
+
* Be sure to link in html only existent resource files, otherwise bundler won't work.
|
130
|
+
* If you have unexistent images in css, bundler will work but you've got info messages in log.
|
@@ -1,10 +1,21 @@
|
|
1
|
-
require 'rails'
|
2
|
-
|
3
1
|
module WebResourceBundler
|
4
|
-
|
5
|
-
|
2
|
+
|
3
|
+
if defined?(Rails::Railtie)
|
4
|
+
require 'rails'
|
5
|
+
class Railtie < Rails::Railtie
|
6
|
+
initializer "web_resource_bundler_initializer.configure_rails_initialization" do
|
7
|
+
ActiveSupport.on_load :action_view do
|
8
|
+
WebResourceBundler::Railtie.insert
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Railtie
|
15
|
+
def self.insert
|
6
16
|
WebResourceBundler::Bundler.setup(Rails.root, Rails.env)
|
7
17
|
ActionView::Base.send(:include, WebResourceBundler::RailsAppHelpers)
|
8
18
|
end
|
9
19
|
end
|
20
|
+
|
10
21
|
end
|
data/rails/init.rb
ADDED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 23
|
9
|
+
version: 0.0.23
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- gregolsen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-07-04 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -59,6 +59,7 @@ extra_rdoc_files: []
|
|
59
59
|
files:
|
60
60
|
- Rakefile
|
61
61
|
- Readme.md
|
62
|
+
- rails/init.rb
|
62
63
|
- lib/web_resource_bundler.rb
|
63
64
|
- lib/web_resource_bundler/exceptions.rb
|
64
65
|
- lib/web_resource_bundler/railtie.rb
|