This change eliminates all external CDN dependencies by bundling JavaScript libraries locally using esbuild. All vendor files are now served from the application's own assets, improving reliability and privacy. Changes: - Created assets/js/vendor.js to bundle all external libraries - Added vendor bundle configuration to esbuild in config files - Updated all templates to use local vendor.js instead of CDN scripts - Created download-vendor-files.sh script to fetch vendor libraries - Added vendor files to .gitignore (they're downloaded during setup) - Updated CSS imports to include vendor stylesheets - Added vendor build step to assets.deploy mix task Bundled libraries: - Leaflet 1.9.4 (mapping library) - Leaflet.heat 0.2.0 (heatmap plugin) - Leaflet.markercluster 1.5.3 (marker clustering) - OverlappingMarkerSpiderfier 0.2.6 (overlapping marker handling) - Chart.js 4.5.0 (charting library) - chartjs-adapter-date-fns 3.0.0 (date adapter for Chart.js) All functionality tested and working correctly with local bundles. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
43 lines
No EOL
1.6 KiB
Shell
Executable file
43 lines
No EOL
1.6 KiB
Shell
Executable file
#!/bin/bash
|
|
|
|
# Script to download vendor JavaScript and CSS files
|
|
# Run this from the project root: ./assets/download-vendor-files.sh
|
|
|
|
set -e
|
|
|
|
echo "Downloading vendor files..."
|
|
|
|
# Ensure vendor directory exists
|
|
mkdir -p assets/vendor
|
|
|
|
cd assets/vendor
|
|
|
|
# Download JavaScript files
|
|
echo "Downloading Leaflet..."
|
|
curl -L -o leaflet.js https://unpkg.com/leaflet@1.9.4/dist/leaflet.js
|
|
|
|
echo "Downloading Leaflet Heat..."
|
|
curl -L -o leaflet-heat.js https://cdn.jsdelivr.net/npm/leaflet.heat@0.2.0/dist/leaflet-heat.js
|
|
|
|
echo "Downloading Chart.js..."
|
|
curl -L -o chart.umd.js https://cdn.jsdelivr.net/npm/chart.js@4.5.0/dist/chart.umd.js
|
|
|
|
echo "Downloading Chart.js date adapter..."
|
|
curl -L -o chartjs-adapter-date-fns.bundle.min.js https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns@3.0.0/dist/chartjs-adapter-date-fns.bundle.min.js
|
|
|
|
echo "Downloading Leaflet MarkerCluster..."
|
|
curl -L -o leaflet.markercluster.js https://unpkg.com/leaflet.markercluster@1.5.3/dist/leaflet.markercluster.js
|
|
|
|
echo "Downloading OverlappingMarkerSpiderfier..."
|
|
curl -L -o oms.min.js https://cdnjs.cloudflare.com/ajax/libs/OverlappingMarkerSpiderfier-Leaflet/0.2.6/oms.min.js
|
|
|
|
# Download CSS files
|
|
echo "Downloading Leaflet CSS..."
|
|
curl -L -o leaflet.css https://unpkg.com/leaflet@1.9.4/dist/leaflet.css
|
|
|
|
echo "Downloading MarkerCluster CSS..."
|
|
curl -L -o MarkerCluster.css https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.css
|
|
curl -L -o MarkerCluster.Default.css https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.Default.css
|
|
|
|
echo "All vendor files downloaded successfully!"
|
|
echo "Run 'mix esbuild vendor' to build the vendor bundle." |