Permalink
Browse files

🔥 railtie

  • Loading branch information...
1 parent cf1632e commit 6d538220a2aefdc1a89375c28621309b85370d5f @josh josh committed Nov 29, 2012
Showing with 30 additions and 16 deletions.
  1. +25 −3 README.md
  2. +5 −13 lib/emoji/railtie.rb
View
28 README.md
@@ -5,17 +5,39 @@ Emoji images and names. See the LICENSE for copyright information.
Installation
-============
+------------
Add `gemoji` to you Gemfile.
``` ruby
-gem 'gemoji', :require => 'emoji/railtie'
+gem 'gemoji'
```
+**Sync images**
+
+Images can be copied to your public directory with `rake emoji` in your Rails app. This is the recommended approach since the images will be available at a consistent location. This works best with cached formatted user content generated by tools like [html-pipeline](https://github.com/jch/html-pipeline).
+
+**Assets Precompiling**
+
+If you must, you can manually add all the images to your asset load path.
+
+``` ruby
+# config/application.rb
+config.assets.paths << Emoji.images_path
+```
+
+Then have them compiled to public on deploy.
+
+`` ruby
+# config/application.rb
+config.assets.precompile << "emoji/*.png"
+```
+
+**WARNING** Since there are a ton of images, just adding the path may slow other lookups down if you aren't using it. Compiling all the emojis on deploy will add overhead to your deploy if even the images haven't changed. Theres just so many more superfluous to iterate over. Also, the urls will be fingerprinted which many not be ideal for referencing from cached content.
+
Example Rails Helper
-====================
+--------------------
This would allow emojifying content such as: `it's raining :cats: and :dogs:!`
View
18 lib/emoji/railtie.rb
@@ -1,14 +1,6 @@
-require 'emoji'
-require 'rails'
+warn "requiring 'emoji/railtie' is deprecated. " +
+ "Please manually add Emoji.images_path to your config.assets.paths."
-module Emoji
- class Railtie < Rails::Railtie
- rake_tasks do
- load "tasks/emoji.rake"
- end
-
- initializer :emoji, :group => :assets do |app|
- app.config.assets.paths << Emoji.images_path
- end
- end
-end
+# Automatic path configuration via a railtie is intentionally removed.
+# Please see the README for details. Any patches to readded it by a
+# non-repo collab will be closed without comment.

1 comment on commit 6d53822

@josh
GitHub member
Please sign in to comment.