Class: Ea::Spa::Output::ShardedMultiFileStrategy
- Defined in:
- lib/ea/spa/output/sharded_multi_file_strategy.rb
Overview
Sharded layout: directory with skeleton.json, search.json, one JSON file per entity under data/, the pre-built SPA bundle (app.js + style.css), and an index.html shell that ties them together. The frontend loads skeleton + search upfront and fetches shards on demand. Suitable for large models that won't fit comfortably in a single HTML file.
Constant Summary
Constants inherited from Strategy
Ea::Spa::Output::Strategy::FRONTEND_APP_JS, Ea::Spa::Output::Strategy::FRONTEND_DIST_DIR, Ea::Spa::Output::Strategy::FRONTEND_STYLE_CSS, Ea::Spa::Output::Strategy::SIZE_THRESHOLD_BYTES
Instance Attribute Summary
Attributes inherited from Strategy
Instance Method Summary collapse
Methods inherited from Strategy
Constructor Details
This class inherits a constructor from Ea::Spa::Output::Strategy
Instance Method Details
#render(projector) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ea/spa/output/sharded_multi_file_strategy.rb', line 15 def render(projector) assert_frontend_bundle! FileUtils.mkdir_p(output_path) FileUtils.mkdir_p(File.join(output_path, "data")) skeleton = projector.skeleton write_json(File.join(output_path, "skeleton.json"), skeleton) write_json(File.join(output_path, "search.json"), projector.search_index) write_shards(projector) write_assets write_index_html(skeleton) output_path end |