Sha256: 64233cb35c0f1c3074a577d0699d8ec1846b76361defa210053d1050aafba23d

Contents?: true

Size: 1.1 KB

Versions: 15

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true
require 'rails'
require 'rails/railtie'
begin
  # Force assets:precompile to be defined before sewing_kit's railtie tries to
  # extend it.
  require "sprockets/railtie" if defined? Rails
# rubocop:disable Lint/HandleExceptions
rescue
  #
end
# rubocop:enable Lint/HandleExceptions
require 'sewing_kit/webpack/compiler'
require 'sewing_kit/webpack/helper'
require 'sewing_kit/webpack/dev'

module SewingKit
  class Railtie < ::Rails::Railtie
    # rubocop:disable Metrics/BlockLength
    config.after_initialize do
      is_development = Rails.env.development? && ENV['SK_SIMULATE_PRODUCTION'] != '1'
      if is_development && (Rails.const_defined?(:Server) || ENV['SK_FORCE_DEV_SERVER'])
        webpack_dev = SewingKit::Webpack::Dev.new
        webpack_dev.start
      end

      ActiveSupport.on_load(:action_controller) do
        include SewingKit::Webpack::Helper
      end

      ActiveSupport.on_load(:action_view) do
        include SewingKit::Webpack::Helper
      end
    end
    # rubocop:enable Metrics/BlockLength

    rake_tasks do
      load "tasks/sewing_kit.rake"
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sewing_kit-0.122.1 lib/sewing_kit/railtie.rb
sewing_kit-0.122.0 lib/sewing_kit/railtie.rb
sewing_kit-0.114.2 lib/sewing_kit/railtie.rb
sewing_kit-0.114.0 lib/sewing_kit/railtie.rb
sewing_kit-0.97.2 lib/sewing_kit/railtie.rb
sewing_kit-0.97.1 lib/sewing_kit/railtie.rb
sewing_kit-0.97.0 lib/sewing_kit/railtie.rb
sewing_kit-0.96.0 lib/sewing_kit/railtie.rb
sewing_kit-0.95.4 lib/sewing_kit/railtie.rb
sewing_kit-0.95.3 lib/sewing_kit/railtie.rb
sewing_kit-0.95.2 lib/sewing_kit/railtie.rb
sewing_kit-0.95.1 lib/sewing_kit/railtie.rb
sewing_kit-0.95.0 lib/sewing_kit/railtie.rb
sewing_kit-0.94.0 lib/sewing_kit/railtie.rb
sewing_kit-0.93.0 lib/sewing_kit/railtie.rb