Sha256: 926b7501d68eaeec859a7931584b2e474a6408056132a2032090b04f86af7b01
Contents?: true
Size: 684 Bytes
Versions: 2
Compression:
Stored size: 684 Bytes
Contents
# Singleton registry for determining NODE_ENV from config/webpacker.yml require "webpacker/file_loader" class Webpacker::Env < Webpacker::FileLoader class << self def current raise Webpacker::FileLoader::FileLoaderError.new("Webpacker::Env.load must be called first") unless instance instance.data end def file_path Rails.root.join("config", "webpacker.yml") end end private def load_data environments = File.exist?(@path) ? YAML.load(File.read(@path)).keys : [].freeze return ENV["NODE_ENV"] if environments.include?(ENV["NODE_ENV"]) return Rails.env if environments.include?(Rails.env) "production" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webpacker-react-on-rails-3.0.0.rc.1 | lib/webpacker/env.rb |
webpacker-react-on-rails-2.0 | lib/webpacker/env.rb |