1
0
Fork 0
cdnjs-rails/README.md

52 lines
1.0 KiB
Markdown
Raw Normal View History

2013-07-17 13:56:30 +00:00
# [cdnjs](http://cdnjs.com) helpers for Rails apps
2013-07-17 13:26:20 +00:00
2013-07-17 13:56:30 +00:00
This gem adds view helpers to Ruby on Rails applications that embed javascripts
and stylesheets directly from [cdnjs](http://cdnjs.com)
2013-07-17 13:26:20 +00:00
## Installation
Add this line to your application's Gemfile:
2013-07-17 13:56:30 +00:00
```ruby
gem 'cdnjs-rails'
```
2013-07-17 13:26:20 +00:00
And then execute:
2013-07-17 13:56:30 +00:00
```
$ bundle
```
2013-07-17 13:26:20 +00:00
## Usage
2013-07-17 13:56:30 +00:00
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
```ruby
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
2013-07-17 13:26:20 +00:00
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request