Can't unregister engine #364

beno opened this Issue Sep 23, 2012 · 1 comment


None yet

2 participants

beno commented Sep 23, 2012

I have a framework that requires template data in unprocessed ejs format and with the .ejs suffix. So I would like to disable the EjsTemplate engine. Is there a way to do this short of creating something like

module Sprockets
  module Engine
    def unregister_engine(ext)

If this can in fact safely be done, you may consider this a pull request :)

beno commented Sep 24, 2012

To answer my own question: I solved this by re-initializing the '.ejs' engine with a dummy template that does nothing to the data. In config/initializers/sprockets.rb:

class NoEngine < Tilt::Template
  def prepare; end
  def evaluate(scope, locals, &block)

Rails.application.assets.register_engine('.ejs', NoEngine)

Edit: I also found it necessary to add this line:

Rails.application.assets.unregister_postprocessor "application/javascript", Sprockets::SafetyColons

This will now serve up the raw ejs from within the asset pipeline.

As an aside: I think these predefined engines should not be hard coded the way they are without any ability to configure/disable them.

@josh josh closed this Feb 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment