README.md in rails_emoji_picker-0.1.0 vs README.md in rails_emoji_picker-0.1.5

- old
+ new

@@ -1,8 +1,9 @@ # Rails Emoji Picker #### Simple integration of emoji picker with your rails application. +[![Gem Version](https://badge.fury.io/rb/rails_emoji_picker.svg)](https://badge.fury.io/rb/rails_emoji_picker) [![Build Status](https://travis-ci.org/ID25/rails_emoji_picker.svg?branch=master)](https://travis-ci.org/ID25/rails_emoji_picker) ## Preview <img src="http://i.giphy.com/l2JI5BX9bj3V7PPlC.gif" alt="Rails Emoji Picker"> ## Installation @@ -18,30 +19,23 @@ Run command ```bash rails g rails_emoji_picker:install ``` -It copies emoji images to your `/public/` directory, adds lines with required js/css files to your application assets and adds precompile images option in `config/initializers/assets.rb` +It copies emoji images to your `/assets/images` directory -Check your `application.js` and `application.(css, scss,sass)` file. +##### Add emoji picker js file -For JS it requires js asset before `//= require_tree .` - -For CSS it requires css asset before `*= require_self` - -For SCSS and SASS adds import `@import 'rails_emoji_picker'` - -##### It should look like this: - `application.js` ```js //= require jquery -//= require turbolinks //= require rails_emoji_picker //= require_tree . ``` +##### And styles + `application.css` ```css /* *= require_tree . @@ -69,13 +63,36 @@ ```erb <%= content_with_emoji(@post.title) %> ``` -If you interpolate string, you need to call `html_safe`, because it is another string. +If you interpolate string, you need to call `html_safe`, because it's another string. ```erb <%= "Post body: #{content_with_emoji(@post.body)}".html_safe %> +``` + +## Emoji Asset Host +By default when used with Rails, this gem will inherit Rails configured `Rails.asset_host`. Otherwise, you will need to manually configure the `Emoji.asset_host` as a string URL or a lambda/proc. + +```ruby +# String URL +Emoji.asset_host = 'http://mysite.com' + +# Custom Host Proc, takes asset path as a param +Emoji.asset_host = lambda {|path| path.size % 2 == 0 ? 'http://even.com' : 'http://odd.com'} +``` + +## Advices +##### Precompile emoji images in development for fast loading +##### Use github (or your hosting) as a CDN, to serve images. + +Example: +```ruby +# => /initializers/emoji_picker.rb + +Emoji.asset_host = 'https://raw.githubusercontent.com' +Emoji.asset_path = '/ID25/rails_emoji_picker/master/lib/generators/rails_emoji_picker/emoji/' ``` That's all! :smiley_cat: ## Contributing