Sha256: e43330046200314c43bfbc398614c41386e99e0a0502dbb1d4bb5231c461b0c7

Contents?: true

Size: 503 Bytes

Versions: 1

Compression:

Stored size: 503 Bytes

Contents

if defined?(Rails)
  class JsRoutes
    class Engine < Rails::Engine
      JS_ROUTES_ASSET = 'js-routes'

      initializer 'js-routes.dependent_on_routes', :after => "sprockets.environment" do
        routes = Rails.root.join('config','routes.rb')
        Rails.application.assets.register_preprocessor 'application/javascript', :'js-routes_dependent_on_routes' do |ctx,data|
          ctx.depend_on(routes) if ctx.logical_path == JS_ROUTES_ASSET
          data
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
js-routes-0.8.0 lib/js_routes/engine.rb