webpack_stats 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/webpack_stats.rb +15 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c98b1242ae20a259f06f4fd76720f4beda28123
4
- data.tar.gz: 35adccc292be1af0ca9639473fa91eabadf3c823
3
+ metadata.gz: 476c287a597979cac309b55344a0f476f9b0b168
4
+ data.tar.gz: 3ebc2d616d3cd7acbab52163ac72ab9c0d9a05c5
5
5
  SHA512:
6
- metadata.gz: eb086b417b8729e58189235694921d8a006039a29e6f23c30a7495e810496760dc4b9a1f2a33e5a37dc11699df5e235ef17af1772265a78fab3992ff3c92d2db
7
- data.tar.gz: 151c241c2a52527fb3295bb91f8f65d485c6683b80bfc937daedbaea71106063bb11195936d6e844adfbbcec1dc1b13c97624e9fd89956e56034dc674db06c72
6
+ metadata.gz: ed395086675f965c920e6f9f00ee392c9d909233a13eddc444b63ca2ab7dce8c130dfaa5e9dfcdc19961eff63dd00cfccb6cd49366850e30c21780e523b48289
7
+ data.tar.gz: b99862ade978a7adf167ac8ebd8acde35cdd3ab52ab0e5c3b32a4f7433e42959b5f91b9fe44de8565e9474b360390f0d01ea23a26ef3977f621022cb8fe0f763
data/lib/webpack_stats.rb CHANGED
@@ -4,8 +4,8 @@ require 'json'
4
4
  module WebpackStats
5
5
  REGEXP = /(.+?)(?:-([0-9a-f]{20,}))?\.(\w+)/
6
6
 
7
- @reload = defined?(::Rails) && ::Rails.env.production? ? false : true
8
- @stats_path = defined?(::Rails) ? ::Rails.root.join('stats.json') : 'stats.json'
7
+ @reload = true
8
+ @stats_path = 'stats.json'
9
9
 
10
10
  class << self
11
11
  attr_accessor :reload, :stats_path, :splitter
@@ -47,18 +47,23 @@ module WebpackStats
47
47
 
48
48
  end
49
49
 
50
- if defined? ::Rails
51
- module Helper
52
- def compute_asset_path source, options = {}
53
- WebpackStats.assets[source] || super
54
- end
50
+ module Helper
51
+ def compute_asset_path source, options = {}
52
+ WebpackStats.assets[source] || super
55
53
  end
56
54
  end
57
-
58
55
  end
59
56
 
60
- if defined? ::ActiveSupport
57
+ begin
58
+ require 'active_support'
61
59
  ActiveSupport.on_load(:action_view) do
62
60
  include WebpackStats::Helper
63
61
  end
64
- end
62
+
63
+ ActiveSupport.on_load(:after_initialize) do
64
+ WebpackStats.configure do |config|
65
+ config.reload = Rails.env.production? ? false : true
66
+ config.stats_path = Rails.root.join('stats.json')
67
+ end
68
+ end
69
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpack_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jian Weihang