Sha256: 64e9ed6c74019a7f46d5036c18f56a7203d39506a0312ecbd0ac83e812ca04e1

Contents?: true

Size: 739 Bytes

Versions: 3

Compression:

Stored size: 739 Bytes

Contents

require "rails"
require "elm/rails/sprockets"

module Elm
  module Rails
    class Railtie < ::Rails::Railtie
      initializer "elm-rails.setup_view_helpers", group: :all do |app|
        ActiveSupport.on_load(:action_view) do
          include ::Elm::Rails::Helper
        end
      end

      initializer "elm-rails.setup_engine", :group => :all do |app|
        sprockets_env = app.assets || app.config.assets
        sprockets_env.paths.concat Dir[app.root.join("app", "assets", "elm")]

        config.assets.configure do |env|
          env.register_mime_type "text/x-elm", extensions: [".elm"]
          env.register_transformer "text/x-elm", "application/javascript", Elm::Rails::Sprockets
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
elm-rails-0.4.2 lib/elm/rails/railtie.rb
elm-rails-0.4.1 lib/elm/rails/railtie.rb
elm-rails-0.4.0 lib/elm/rails/railtie.rb