Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add asset pipeline guides section on implementing & registering own e…

  • Loading branch information...
commit 38efe878c9ae66d29300bdfba867eddf84386824 1 parent ffa9540
@goshakkk goshakkk authored
Showing with 25 additions and 1 deletion.
  1. +25 −1 guides/source/
26 guides/source/
@@ -720,7 +720,31 @@ A good example of this is the `jquery-rails` gem which comes with Rails as the s
Making Your Library or Gem a Pre-Processor
-TODO: Registering gems on [Tilt]( enabling Sprockets to find them.
+As Sprockets uses [Tilt]( as a generic
+interface to different templating engines, your gem should just
+implement the Tilt template protocol. Normally, you would subclass
+`Tilt::Template` and reimplement `evaluate` method to return final
+output. Template source is stored at `@code`. Have a look at
+sources to learn more.
+module BangBang
+ class Template < ::Tilt::Template
+ # Adds a "!" to original template.
+ def evaluate(scope, locals, &block)
+ "#{@code}!"
+ end
+ end
+Now that you have a `Template` class, it's time to associate it with an
+extenstion for template files:
+Sprockets.register_engine '.bang', BangBang::Template
Upgrading from Old Versions of Rails
Please sign in to comment.
Something went wrong with that request. Please try again.