lib/sewing_kit/webpack/manifest.rb in sewing_kit-0.93.0 vs lib/sewing_kit/webpack/manifest.rb in sewing_kit-0.94.0
- old
+ new
@@ -52,19 +52,37 @@
def manifest
instance.manifest
end
def instance
- mode = ENV['NODE_ENV'] || Rails.env.to_s
- @instance ||= if mode == 'development' && ENV['SK_SIMULATE_PRODUCTION'] != '1'
+ return Production.new if simulate_production?
+
+ @instance ||= if mode == 'development'
Development.new
+ elsif skip_assets?
+ TestWithNoAssets.new
else
Production.new
end
end
+
+ private
+
+ def mode
+ ENV['NODE_ENV'] || Rails.env.to_s
+ end
+
+ def skip_assets?
+ mode == 'test' && SewingKit.configuration.test_manifest_mode == :return_no_assets
+ end
+
+ def simulate_production?
+ ENV['SK_SIMULATE_PRODUCTION'] == '1' || ENV['SK_SIMULATE_PRODUCTION'] == 'true'
+ end
end
end
end
end
require 'sewing_kit/webpack/manifest/development'
require 'sewing_kit/webpack/manifest/production'
+require 'sewing_kit/webpack/manifest/test_with_no_assets'