722c155a42 | ||
---|---|---|
data | ||
lib | ||
.gitignore | ||
Gemfile | ||
LICENSE.txt | ||
README.md | ||
Rakefile | ||
cdnjs-rails.gemspec |
README.md
cdnjs helpers for Rails apps
This gem adds view helpers to Ruby on Rails applications that embed javascripts and stylesheets directly from cdnjs
Installation
Add this line to your application's Gemfile:
gem 'cdnjs-rails'
And then execute:
$ bundle
Usage
From view files
<html>
<head>
<title>Hello World!</title>
<%= stylesheet_cdnjs_tag 'normalize' %>
</head>
<body>
<%= yield %>
<%= javascript_cdnjs_tag 'jquery', version: '2.0.3', protocol: 'https' %>
</body>
</html>
From anywhere in the app
CdnjsRails.package_url('chosen', v: '0.9.10', proto: 'http')
Options
version
(aliases: ver
, v
): package version, latest by default
protocol
(alias: proto
): url protocol, relative by default
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request