bootstrap-cdn-rails 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +54 -0
- data/lib/bootstrap-cdn-rails.rb +5 -0
- data/lib/bootstrap-cdn-rails/action_view_helpers.rb +26 -0
- data/lib/bootstrap-cdn-rails/engine.rb +6 -0
- data/lib/bootstrap-cdn-rails/railtie.rb +11 -0
- data/lib/bootstrap-cdn-rails/version.rb +5 -0
- metadata +52 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 11cb6861a53b71d54a7aeb6d60fa4c2f7a0b7dc1
|
4
|
+
data.tar.gz: e61fab39445ef48e09252847cc3e453898b338ff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b2e7f7338166ad3ca998bb22a585fccd98c0e83d49061fc22995d6216166642d921ca2016f182a8ba657fcf660a6096d92337c8675926874d57672af7db6ddc2
|
7
|
+
data.tar.gz: 3c4d11bcde744ac4b62463882c84c214b5d44ee2734897c2ab901cb2d04526eed0d868a23756659092dc9050ae453c68ad9829d59b9769078842a1cdd2a68da6
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Christopher Brito [me@christopherbrito.com]
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
bootstrap-cdn-rails
|
2
|
+
=====================
|
3
|
+
|
4
|
+
Easily add support for [BootstrapCDN](http://bootstrapcdn.com) hosted assets to your Rails 3 or 4 project.
|
5
|
+
|
6
|
+
|
7
|
+
## Benefits
|
8
|
+
* Offloads loading of the Bootstrap, Font Awesome and Bootswatch assets from your host, allowing your browser to execute more HTTP requests in parallel - resulting in faster overall page loads.
|
9
|
+
* Leverages the cached copy on a client so your page will load faster if a user already has visited a site using a CDN hosted copy of Bootstrap, Font Awesome or Bootswatch.
|
10
|
+
|
11
|
+
## Features
|
12
|
+
* Support for the latest versions of [Font Awesome](http://fontawesome.io), [Bootstrap](http://getbootstrap.com) and [Bootswatch](http://bootswatch.com/)
|
13
|
+
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
|
18
|
+
__Gemfile__
|
19
|
+
|
20
|
+
Update your Gemfile to include this gem:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
...
|
24
|
+
gem 'bootstrap-cdn-rails'
|
25
|
+
```
|
26
|
+
|
27
|
+
Run `bundle install` to update your local gems. Restart your Rails server if necessary.
|
28
|
+
|
29
|
+
__Layout__
|
30
|
+
|
31
|
+
The gem will add the following helpers:
|
32
|
+
|
33
|
+
* `boostrap_css_include_tag`
|
34
|
+
* `boostrap_js_include_tag`
|
35
|
+
* `fontawesome_css_include_tag`
|
36
|
+
* `bootswatch_css_include_tag`
|
37
|
+
|
38
|
+
Add these to your layout files inside the `head` section to automatically include the relevant library.
|
39
|
+
|
40
|
+
```html
|
41
|
+
<!DOCTYPE html>
|
42
|
+
<html>
|
43
|
+
<head>
|
44
|
+
...
|
45
|
+
<%= fontawesome_css_include_tag %>
|
46
|
+
...
|
47
|
+
</head>
|
48
|
+
...
|
49
|
+
```
|
50
|
+
|
51
|
+
## License
|
52
|
+
(c) 2014 Christopher Brito
|
53
|
+
|
54
|
+
MIT License - reference [LICENSE](/LICENSE) file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module BootstrapCDN::Rails
|
2
|
+
module ActionViewExtensions
|
3
|
+
OFFLINE = ( ::Rails.env.development? )
|
4
|
+
|
5
|
+
BOOTSTRAP_VERSIONS = ["3.0.3", "3.0.2", "3.0.1", "3.0.0", "2.3.2"]
|
6
|
+
FONTAWESOME_VERSIONS = [ '4.0.3', '3.2.1' ]
|
7
|
+
|
8
|
+
def boostrap_css_include_tag(options = {version: BOOTSTRAP_VERSIONS.first})
|
9
|
+
stylesheet_link_tag("//netdna.bootstrapcdn.com/bootstrap/#{options[:version]}/css/bootstrap.min.css", options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def boostrap_js_include_tag(options = {version: BOOTSTRAP_VERSIONS.first})
|
13
|
+
javascript_include_tag("//netdna.bootstrapcdn.com/bootstrap/#{version}/js/bootstrap.min.js", options)
|
14
|
+
end
|
15
|
+
|
16
|
+
def fontawesome_css_include_tag(options = {version: FONTAWESOME_VERSIONS.first})
|
17
|
+
stylesheet_link_tag("//netdna.bootstrapcdn.com/font-awesome/#{options[:version]}/css/font-awesome.min.css", options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def bootswatch_css_include_tag(options = {version: BOOTSTRAP_VERSIONS.first, name: "cosmo"})
|
21
|
+
stylesheet_link_tag("//netdna.bootstrapcdn.com/bootswatch/#{options[:version]}/#{options[:name]}/bootstrap.min.css", options)
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module BootstrapCDN
|
2
|
+
module Rails
|
3
|
+
class Railtie < ::Rails::Railtie
|
4
|
+
initializer 'bootstrap-cdn-rails.action_view' do |app|
|
5
|
+
ActiveSupport.on_load(:action_view) do
|
6
|
+
include BootstrapCDN::Rails::CDN::ActionViewExtensions
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end # class Railtie
|
10
|
+
end # module Rails
|
11
|
+
end # module FontAwesome
|
metadata
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bootstrap-cdn-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Christopher Brito
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-09 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Bootstrap CDN support for Rails 3 and 4
|
14
|
+
email:
|
15
|
+
- cbrito@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/bootstrap-cdn-rails/action_view_helpers.rb
|
21
|
+
- lib/bootstrap-cdn-rails/engine.rb
|
22
|
+
- lib/bootstrap-cdn-rails/railtie.rb
|
23
|
+
- lib/bootstrap-cdn-rails/version.rb
|
24
|
+
- lib/bootstrap-cdn-rails.rb
|
25
|
+
- LICENSE
|
26
|
+
- README.md
|
27
|
+
homepage: https://github.com/cbrito/bootstrap-cdn-rails
|
28
|
+
licenses:
|
29
|
+
- MIT
|
30
|
+
metadata: {}
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options: []
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
requirements: []
|
46
|
+
rubyforge_project:
|
47
|
+
rubygems_version: 2.0.3
|
48
|
+
signing_key:
|
49
|
+
specification_version: 4
|
50
|
+
summary: Leverage the Bootstrap CDN for asset hosting, faster page load and rendering
|
51
|
+
time.
|
52
|
+
test_files: []
|