Sha256: fecab9b9f01a43d1f2dd086c7fcf16121e5347a7a6a69147f57fbc0d6f3853ef

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

require 'typescript/rails'

class Typescript::Rails::Railtie < ::Rails::Railtie
  config.before_initialize do |app|
    if ::Rails::VERSION::MAJOR >= 4 || app.config.assets.enabled
      require 'typescript/rails/template'
      require 'typescript/rails/transformer'
      require 'sprockets'

      if Sprockets.respond_to?(:register_engine)
        Sprockets.register_engine '.ts', Typescript::Rails::Template, silence_deprecation: true
      end

      if Sprockets.respond_to?(:register_transformer)
        Sprockets.register_mime_type 'text/typescript', extensions: ['.js.ts']
        Sprockets.register_transformer 'text/typescript', 'application/javascript', Typescript::Rails::Transformer
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
typescript-rails-0.6.2.2 lib/typescript/rails/railtie.rb