Class: ReactManifest::Reporter
- Inherits:
-
Object
- Object
- ReactManifest::Reporter
- Defined in:
- lib/react_manifest/reporter.rb
Overview
Reports per-bundle sizes by reading the Sprockets compiled manifest.
Run after ‘rails assets:precompile` to see:
Bundle Raw (KB) Gzip (KB)
ux_shared.js 420 130
ux_notifications.js 95 31 ✓
ux_reports.js 610 190 ⚠
Instance Method Summary collapse
-
#initialize(config = ReactManifest.configuration) ⇒ Reporter
constructor
A new instance of Reporter.
- #report ⇒ Object
Constructor Details
#initialize(config = ReactManifest.configuration) ⇒ Reporter
Returns a new instance of Reporter.
13 14 15 |
# File 'lib/react_manifest/reporter.rb', line 13 def initialize(config = ReactManifest.configuration) @config = config end |
Instance Method Details
#report ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/react_manifest/reporter.rb', line 17 def report manifest = load_sprockets_manifest bundles = collect_bundles(manifest) if bundles.empty? puts "[ReactManifest] No ux_*.js bundles found in compiled assets." puts " Run `rails assets:precompile` first." return end print_table(bundles) end |