jquery-ui-rails-cdn 0.1.0 → 0.1.1
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/README.md +16 -21
- data/lib/jquery-ui-rails-cdn/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# jquery-ui-rails-cdn
|
2
2
|
|
3
|
-
Add CDN support to
|
3
|
+
Add CDN support to
|
4
4
|
|
5
5
|
* [jquery-ui-rails](https://github.com/joliss/jquery-ui-rails).
|
6
6
|
|
7
|
+
This gem is designed to be used with [jquery-rails-cdn](https://github.com/kenn/jquery-rails-cdn)
|
8
|
+
|
7
9
|
Serving javascripts and stylesheets from a publicly available [CDN](http://en.wikipedia.org/wiki/Content_Delivery_Network) has clear benefits:
|
8
10
|
|
9
11
|
* **Speed**: Users will be able to download jQuery UI from the closest physical location.
|
@@ -14,42 +16,35 @@ Serving javascripts and stylesheets from a publicly available [CDN](http://en.wi
|
|
14
16
|
|
15
17
|
This gem offers the following features:
|
16
18
|
|
17
|
-
* Supports multiple CDN. (Google, Microsoft and jqueryui.com)
|
18
|
-
* jQuery
|
19
|
-
* Automatically fallback to jquery-rails' bundled jQuery when:
|
19
|
+
* Supports multiple CDN. (Google, Microsoft, Yandex and jqueryui.com)
|
20
|
+
* jQuery-UI version is automatically detected via jquery-ui-rails.
|
21
|
+
* Automatically fallback to jquery-ui-rails' bundled jQuery UI when:
|
20
22
|
* You're on a development environment so that you can work offline.
|
21
23
|
* The CDN is down or unavailable.
|
22
24
|
|
23
|
-
On top of that, if you're using asset pipeline, you may have noticed that the major chunks of the code in `application.js` is jQuery. Implications of externalizing jQuery from `application.js` are:
|
25
|
+
On top of that, if you're using asset pipeline, you may have noticed that the major chunks of the code in `application.js` is jQuery UI. Implications of externalizing jQuery UI from `application.js` are:
|
24
26
|
|
25
|
-
* Updating your js code won't evict the entire cache in browsers - your code changes more often than jQuery upgrades, right?
|
27
|
+
* Updating your js code won't evict the entire cache in browsers - your code changes more often than jQuery UI upgrades, right?
|
26
28
|
* `rake assets:precompile` takes less peak memory usage.
|
27
29
|
|
28
30
|
Changelog:
|
29
31
|
|
30
|
-
* v0.
|
31
|
-
* v0.2.1: Add Angular.js
|
32
|
-
* v0.2.0: Update to match original codes and update bootstrap to 2.1.0
|
33
|
-
* v0.1.2: Added bootstrap.
|
34
|
-
* v0.1.1: Added jQuery-UI
|
35
|
-
* v0.1.0: Added `:google_schemeless` for sites that support both ssl / non-ssl
|
36
|
-
* v0.0.1: Initial release
|
32
|
+
* v0.1.0: Initial release
|
37
33
|
|
38
34
|
## Installation
|
39
35
|
|
40
36
|
Add this line to your application's Gemfile:
|
41
37
|
|
42
38
|
```ruby
|
43
|
-
gem 'jquery-rails-cdn'
|
39
|
+
gem 'jquery-ui-rails-cdn'
|
44
40
|
```
|
45
41
|
|
46
42
|
## Usage
|
47
43
|
|
48
44
|
This gem adds these methods to generate a script tag to the jQuery on a CDN of your preference:
|
49
|
-
`jquery_include_tag` and `jquery_url`
|
50
45
|
`jQuery_ui_include_tag` and `jquery_ui_url`
|
51
46
|
|
52
|
-
If you're using asset pipeline with Rails 3.1+, first remove `//= require jquery`
|
47
|
+
If you're using asset pipeline with Rails 3.1+, first remove `//= require jquery-ui` (or other special files if you are using not full version) from `application.js`.
|
53
48
|
|
54
49
|
Then in layout:
|
55
50
|
|
@@ -74,13 +69,13 @@ Note that valid CDN symbols for bootstrap are:
|
|
74
69
|
:default
|
75
70
|
```
|
76
71
|
|
77
|
-
It will generate the following for jQuery
|
72
|
+
It will generate the following for jQuery-UI on production:
|
78
73
|
|
79
74
|
```html
|
80
|
-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.
|
75
|
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.4/jquery.min.js" type="text/javascript"></script>
|
81
76
|
<script type="text/javascript">
|
82
77
|
//<![CDATA[
|
83
|
-
window.jQuery || document.write(unescape('%3Cscript src="/assets/jquery-
|
78
|
+
window.jQuery || document.write(unescape('%3Cscript src="/assets/jquery-ui-3aaa3fa0b0207a1abcd30555987cd4cc.js" type="text/javascript">%3C/script>'))
|
84
79
|
//]]>
|
85
80
|
</script>
|
86
81
|
```
|
@@ -94,10 +89,10 @@ on development:
|
|
94
89
|
If you want to check the production URL, you can pass `:force => true` as an option.
|
95
90
|
|
96
91
|
```ruby
|
97
|
-
|
92
|
+
jquery_ui_include_tag :google, :force => true
|
98
93
|
```
|
99
94
|
|
100
|
-
To fallback to rails assets when CDN is not available, add `jquery
|
95
|
+
To fallback to rails assets when CDN is not available, add `jquery-ui.js` in `config/environments/production.rb`
|
101
96
|
|
102
97
|
```ruby
|
103
98
|
config.assets.precompile += %w( jquery.js jquery-ui.js )
|