home
/
u941026986
/
domains
/
paratune.com
/
public_html
➕ New
📤 Upload
✎ Editing:
VENDOR_ASSETS_README.md
← Back
# Vendor Assets Migration Guide This guide explains how to migrate from CDN dependencies to local vendor assets for better reliability and performance. ## Why Local Assets? 1. **No Ad Blocker Interference** - CDN scripts are often blocked by ad blockers 2. **Faster Load Times** - No external network requests 3. **Offline Support** - Works without internet connection 4. **Version Control** - Assets are versioned with your code 5. **Better Security** - No dependency on external CDN availability ## Quick Start ### Step 1: Download Vendor Assets Run the download script to fetch all CDN assets: ```bash ./download-vendor-assets.sh ``` This will create `public/vendor/` directory with all assets organized by library. ### Step 2: Update Composer Autoload The helper function is already added to `composer.json`. Run: ```bash composer dump-autoload ``` ### Step 3: Update CDN References (Optional) For automated updates, run: ```bash chmod +x update-cdn-to-local.sh ./update-cdn-to-local.sh ``` **Note:** Review changes manually as some may need adjustment. ### Step 4: Test 1. Clear Laravel caches: ```bash php artisan view:clear php artisan cache:clear ``` 2. Test your application to ensure all assets load correctly ## Asset Helper Function Use the `vendor_asset()` helper function in Blade templates: ```blade <!-- Instead of CDN --> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <!-- Use local asset --> <script src="{{ vendor_asset('chart.js/chart.min.js') }}"></script> ``` The helper automatically adds version query strings for cache busting. ## Assets Included - ✅ Chart.js - ✅ date-fns - ✅ chartjs-adapter-date-fns - ✅ SunEditor (with CSS and language files) - ✅ FullCalendar - ✅ SweetAlert - ✅ Select2 - ✅ jQuery UI - ✅ Tribute.js - ✅ Toastr - ✅ Signature Pad - ✅ Bootstrap 5 - ✅ html2pdf.js - ✅ Leaflet ## Assets That Should Remain CDN ### OneSignal SDK **Must use CDN** - OneSignal requires their official CDN for proper functionality. ### Google Fonts Can be self-hosted if needed, but Google's CDN is reliable and fast. ## Manual Updates Some files may need manual updates. Search for CDN URLs: ```bash grep -r "cdn.jsdelivr.net\|unpkg.com\|cdnjs.cloudflare.com" resources/views/ ``` Replace with `vendor_asset()` helper function. ## Updating Assets To update vendor assets: 1. Delete the specific library folder in `public/vendor/` 2. Update the download script with new version URLs 3. Re-run `./download-vendor-assets.sh` 4. Test thoroughly ## Font Awesome Font Awesome is currently using CDN. To self-host: 1. Download Font Awesome from their website 2. Extract to `public/vendor/font-awesome/` 3. Update references to use `vendor_asset('font-awesome/css/all.min.css')` ## Troubleshooting ### Assets Not Loading 1. Check file permissions: `chmod -R 755 public/vendor` 2. Verify files exist: `ls -la public/vendor/` 3. Check browser console for 404 errors 4. Clear browser cache ### Helper Function Not Found Run: `composer dump-autoload` ### Version Conflicts If you need different versions, create versioned folders: - `public/vendor/chart.js/v4.4.0/` - `public/vendor/chart.js/v3.9.1/` Then reference the specific version in your templates. ## Benefits Achieved - ✅ No more blocked scripts by ad blockers - ✅ Faster page loads (no external requests) - ✅ Better reliability (no CDN downtime) - ✅ Version control of all dependencies - ✅ Works offline
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel