Sha256: 6dd3751613b7a01f5f892ef7eb0a8a8285f2d1d095d55c033ba132b6886308ba

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

Contents

module SlimAssets
  class Engine < ::Rails::Engine
    initializer 'slim_assets.assets.register', :group => :all do |app|
      app.config.assets.configure do |sprockets_env|
        if sprockets_env.respond_to?(:register_transformer)
          sprockets_env.register_mime_type 'application/vnd.slim-template.slim+text', extensions: ['.slim']
          sprockets_env.register_transformer 'application/vnd.slim-template.slim+text', 'application/javascript', SlimSprocketsEngine
        end

        if sprockets_env.respond_to?(:register_engine)
          args = ['.slim', SlimSprocketsEngine]
          args << { silence_deprecation: true } if Sprockets::VERSION.start_with?('3')
          sprockets_env.register_engine(*args)
        end
      end
    end
  end
end

module SlimAssets
  class Railtie < ::Rails::Railtie
    if ::Rails.version.to_f >= 3.1
      config.app_generators.javascript_template_engine :slim
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slim_assets-0.0.3 lib/slim_assets/engine.rb