Readme fixes
This commit is contained in:
parent
588fdd0f64
commit
722c155a42
44
README.md
44
README.md
|
@ -1,24 +1,46 @@
|
|||
# Cdnjs::Rails
|
||||
# [cdnjs](http://cdnjs.com) helpers for Rails apps
|
||||
|
||||
TODO: Write a gem description
|
||||
This gem adds view helpers to Ruby on Rails applications that embed javascripts
|
||||
and stylesheets directly from [cdnjs](http://cdnjs.com)
|
||||
|
||||
## Installation
|
||||
|
||||
Add this line to your application's Gemfile:
|
||||
|
||||
gem 'cdnjs-rails'
|
||||
```ruby
|
||||
gem 'cdnjs-rails'
|
||||
```
|
||||
|
||||
And then execute:
|
||||
|
||||
$ bundle
|
||||
|
||||
Or install it yourself as:
|
||||
|
||||
$ gem install cdnjs-rails
|
||||
```
|
||||
$ bundle
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
TODO: Write usage instructions here
|
||||
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
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
4
Rakefile
4
Rakefile
|
@ -22,10 +22,10 @@ namespace :cdnjs do
|
|||
}
|
||||
end.inject(:merge)
|
||||
|
||||
# Format JSON for better diffs and smaller patches
|
||||
# Pretty format JSON for better diffs and smaller patches
|
||||
json = MultiJson.dump(data, :pretty => true)
|
||||
|
||||
File.open(file_path, 'wb') do |file|
|
||||
File.open file_path, 'wb' do |file|
|
||||
file.write json
|
||||
file.close
|
||||
end
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
module CdnjsRails
|
||||
module ViewHelpers
|
||||
def javascript_cdnjs_tag name, version = nil
|
||||
javascript_include_tag CdnjsRails.package_url(name, version)
|
||||
def javascript_cdnjs_tag name, options = {}
|
||||
javascript_include_tag CdnjsRails.package_url(name, options)
|
||||
end
|
||||
|
||||
def stylesheet_cdnjs_tag name, version = nil
|
||||
stylesheet_include_tag CdnjsRails.package_url(name, version)
|
||||
def stylesheet_cdnjs_tag name, options = {}
|
||||
stylesheet_include_tag CdnjsRails.package_url(name, options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue