Sha256: 1b4d4c5c8287abf0cd48d52b91fa00cb90e04d537ca87697e3de37f8ae00bd37

Contents?: true

Size: 843 Bytes

Versions: 1

Compression:

Stored size: 843 Bytes

Contents

# frozen_string_literal: true

require "rails"
require "rails/railtie"

require "sewing_kit/webpack/compiler"
require "sewing_kit/webpack/helper"
require "sewing_kit/webpack/dev"
require "sewing_kit/webpack/server"

module SewingKit
  class Railtie < ::Rails::Railtie
    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
    rake_tasks do
      load "tasks/sewing_kit.rake"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sewing_kit-0.130.1 lib/sewing_kit/railtie.rb