File tree Expand file tree Collapse file tree 6 files changed +19
-4
lines changed
Expand file tree Collapse file tree 6 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 5959 - name : 📍 Generate DojoMap from Earth/Japan data
6060 run : |
6161 bundle exec rake upsert_dojos_geojson
62+ bundle exec rake compact_geojson
6263
6364 - name : 🆙 Commit latest data to update DojoMap (if any)
6465 run : |
7980
8081 # Save GeoJSON data to render DojoMap
8182 git add dojos.geojson
83+ git add dojos.min.geojson
8284
8385 # Commit changed files above
8486 git commit -m '🤖 Upsert Earth/Japan data for DojoMap'
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ task(:get_data_from_japan) { ruby 'get_data_from_japan.rb' }
77task ( :cache_dojo_logos ) { ruby 'cache_dojo_logos.rb' }
88task ( :cache_data_as_yaml ) { ruby 'cache_data_as_yaml.rb' }
99task ( :upsert_dojos_geojson ) { ruby 'upsert_dojos_geojson.rb' }
10+ task ( :compact_geojson ) { ruby 'compact_geojson.rb' }
1011
1112# GitHub - gjtorikian/html-proofer
1213# https://github.com/gjtorikian/html-proofer
Original file line number Diff line number Diff line change 11#!/usr/bin/env ruby
22require 'json'
33
4- # Just compact it for better loading by Computer
4+ # Create a minified version of dojos.geojson for production use
55geojson = JSON . load ( File . read ( "dojos.geojson" ) )
6- File . open ( 'dojos.geojson' , 'w' ) do |file |
6+
7+ # Write minified version (no whitespace)
8+ File . open ( 'dojos.min.geojson' , 'w' ) do |file |
79 JSON . dump ( geojson , file )
810end
11+
12+ # Calculate size reduction
13+ original_size = File . size ( "dojos.geojson" )
14+ minified_size = File . size ( "dojos.min.geojson" )
15+ reduction = ( ( original_size - minified_size ) * 100.0 / original_size ) . round ( 1 )
16+
17+ puts "✅ Created dojos.min.geojson"
18+ puts " Original: #{ ( original_size / 1024.0 ) . round ( 1 ) } KB"
19+ puts " Minified: #{ ( minified_size / 1024.0 ) . round ( 1 ) } KB"
20+ puts " Reduction: #{ reduction } %"
Original file line number Diff line number Diff line change 6363 < body >
6464 < div
6565 class ="geolonia "
66- data-geojson ="./dojos.geojson "
66+ data-geojson ="./dojos.min. geojson "
6767 data-lat ="35.6809591 "
6868 data-lng ="139.7673068 "
6969 data-zoom ="5 "
Original file line number Diff line number Diff line change 6060 < body >
6161 < div
6262 class ="geolonia "
63- data-geojson ="./dojos.geojson "
63+ data-geojson ="./dojos.min. geojson "
6464 data-lat ="35.6809591 "
6565 data-lng ="139.7673068 "
6666 data-zoom ="0 "
You can’t perform that action at this time.
0 commit comments