jquery-rails-cdn-yjchen 0.3.1 → 0.3.2
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 +11 -0
- data/lib/jquery-rails-cdn.rb +10 -4
- data/lib/jquery-rails-cdn/version.rb +1 -1
- metadata +10 -5
data/README.md
CHANGED
@@ -27,6 +27,7 @@ On top of that, if you're using asset pipeline, you may have noticed that the ma
|
|
27
27
|
|
28
28
|
Changelog:
|
29
29
|
|
30
|
+
* v0.3.2: Support using minimized libraries.
|
30
31
|
* v0.3.1: Fix packaging bug.
|
31
32
|
* v0.3.0: Microsoft and Yandex are now always scheme-less. (Thanks to @atipugin)
|
32
33
|
* v0.2.2: Remove Bootstrap and Angular.js to their own rails engine.
|
@@ -105,5 +106,15 @@ To fallback to rails assets when CDN is not available, add `jquery.js` and `jque
|
|
105
106
|
config.assets.precompile += %w( jquery.js jquery-ui.js )
|
106
107
|
```
|
107
108
|
|
109
|
+
## Options
|
110
|
+
|
111
|
+
Set :compressed to use minimized library locally like this:
|
112
|
+
|
113
|
+
= jquery_include_tag :default, :compressed => true
|
114
|
+
|
115
|
+
Remember to change the assets name in confign/environments/production.rb:
|
116
|
+
|
117
|
+
config.assets.precompile += %w( jquery.min.js)
|
118
|
+
|
108
119
|
## Clarification
|
109
120
|
[jquery-rails-cdn](https://github.com/kenn/jquery-rails-cdn) supports jQuery from jquery-rails gem, but [not jQuery UI](https://github.com/kenn/jquery-rails-cdn/issues/11) in the same gem. [jquery-ui-rails-cdn](https://github.com/styx/jquery-ui-rails-cdn) supports jQuery UI from jquery-ui-rails gem. This one supports both jQuery and jQuery UI from jquery-rails gem.
|
data/lib/jquery-rails-cdn.rb
CHANGED
@@ -31,21 +31,27 @@ module Jquery::Rails::Cdn
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def jquery_include_tag(name, options = {})
|
34
|
+
jquery = 'jquery'
|
35
|
+
jquery = jquery + '.min' if options[:compressed]
|
36
|
+
|
34
37
|
if OFFLINE and !options[:force]
|
35
|
-
return javascript_include_tag(
|
38
|
+
return javascript_include_tag(jquery)
|
36
39
|
else
|
37
40
|
[ javascript_include_tag(jquery_url(name, options)),
|
38
|
-
javascript_tag("window.jQuery || document.write(unescape('#{javascript_include_tag(
|
41
|
+
javascript_tag("window.jQuery || document.write(unescape('#{javascript_include_tag(jquery).gsub('<','%3C')}'))")
|
39
42
|
].join("\n").html_safe
|
40
43
|
end
|
41
44
|
end
|
42
45
|
|
43
46
|
def jquery_ui_include_tag(name, options = {})
|
47
|
+
jqueryui = 'jquery-ui'
|
48
|
+
jqueryui = jqueryui + '.min' if options[:compressed]
|
49
|
+
|
44
50
|
if OFFLINE and !options[:force]
|
45
|
-
return javascript_include_tag(
|
51
|
+
return javascript_include_tag(jqueryui)
|
46
52
|
else
|
47
53
|
[ javascript_include_tag(jquery_ui_url(name, options)),
|
48
|
-
javascript_tag("window.jQuery.ui || document.write(unescape('#{javascript_include_tag(
|
54
|
+
javascript_tag("window.jQuery.ui || document.write(unescape('#{javascript_include_tag(jqueryui).gsub('<','%3C')}'))")
|
49
55
|
].join("\n").html_safe
|
50
56
|
end
|
51
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-rails-cdn-yjchen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-12-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jquery-rails
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,12 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
26
31
|
description: Add CDN support to jquery-rails
|
27
32
|
email:
|
28
33
|
- kenn.ejima@gmail.com
|
@@ -60,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
65
|
version: '0'
|
61
66
|
requirements: []
|
62
67
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.8.
|
68
|
+
rubygems_version: 1.8.23
|
64
69
|
signing_key:
|
65
70
|
specification_version: 3
|
66
71
|
summary: Add CDN support to jquery-rails
|