lib/sewing_kit/railtie.rb in sewing_kit-0.91.0 vs lib/sewing_kit/railtie.rb in sewing_kit-0.92.0
- old
+ new
@@ -14,32 +14,24 @@
require 'sewing_kit/webpack/helper'
require 'sewing_kit/webpack/dev'
module SewingKit
class Railtie < ::Rails::Railtie
- initializer "sewing_kit.cache_production_manifest" do
- unless SewingKit::Railtie.development_server? || Rails.env.test?
- SewingKit::CachedProductionManifest = SewingKit::Webpack::Manifest::Base.load_metadata_from_node
- end
- end
# rubocop:disable Metrics/BlockLength
config.after_initialize do
- if SewingKit::Railtie.development_server?
+ 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_view) do
include SewingKit::Webpack::Helper
end
end
+ # rubocop:enable Metrics/BlockLength
+
rake_tasks do
load "tasks/sewing_kit.rake"
- end
-
- def self.development_server?
- Rails.env.development? &&
- ENV['SK_SIMULATE_PRODUCTION'] != '1' &&
- (Rails.const_defined?(:Server) || ENV['SK_FORCE_DEV_SERVER'])
end
end
end