Sha256: dccd14aeeac92142d0538af313990ab08841a40ddec5b4b3c5afbd70b3d58ed0

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

require 'typescript/monkey'

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
typescript-monkey-0.9.0 lib/typescript/monkey/railtie.rb