web_cache_killer 0.0.2
web_cache_killer: ^0.0.2 copied to clipboard
A Flutter package that solves Flutter web cache problems by automatically renaming JavaScript files with timestamps during build process.
Web Cache Killer #
A Flutter package that solves Flutter web cache problems by automatically renaming JavaScript files with timestamps during build process.
The Problem #
Flutter web apps often face caching issues where users see old versions of your app even after deployment. Browsers cache JavaScript files aggressively, causing users to see outdated content until they manually clear their cache.
The Solution #
Web Cache Killer automatically renames your Flutter web JavaScript files with unique timestamps and updates all references, ensuring users always get the latest version of your app without manual cache clearing.
Features #
- ๐ง Cross-platform - Works on Windows, macOS, and Linux
- ๐ฆ Zero dependencies - Uses built-in Dart archive package
- ๐ Cache busting - Automatic timestamp-based cache busting
- ๐ Simple commands - Easy to use CLI tool
- ๐ค Optional upload - Upload to tmpfiles.org and get direct download link
http://tmpfiles.org/dl/123456/web.zip
Installation #
dart pub global activate web_cache_killer
Usage #
Basic Commands #
# Build and create zip
web_cache_killer
# Custom name (creates build/app/ and app.zip)
web_cache_killer --name app
# Auto upload
web_cache_killer --auto-upload
# Build only (no zip)
web_cache_killer --no-zip
Options #
# Verbose output
web_cache_killer --verbose
# Skip clean step (faster)
web_cache_killer --no-clean
# Combined options
web_cache_killer --name myapp --auto-upload --verbose
How It Works #
Automatically renames JavaScript files with timestamps for cache busting:
Before:
flutter.js โ flutter_20241201_143022_456.js
main.dart.js โ main_20241201_143022_456.dart.js
All references in HTML files are automatically updated.
File Structure #
Default:
build/
โโโ web/ # Built files
โโโ web.zip # Package
Custom name:
build/
โโโ app/ # Built files
โโโ app.zip # Package
Expected Output #
๐ Web Cache Killer
==================================
Checking requirements...
โ
Requirements satisfied
๐งน Cleaning...
โ
Cleaned
๐ง Building web...
โ
Build completed
๐ Applying cache busting...
โ
Cache busting applied (3 files)
๐ฆ Creating deployment package...
โ
Successfully created web.zip (Size: 7.9 MB)
==================================
โ
๐ Build Completed!
โ
Created: web.zip
๐ Local: /path/to/project/build/web.zip
Troubleshooting #
- "pubspec.yaml not found" - Run from Flutter project root
- "Flutter not found" - Install Flutter SDK and add to PATH
- Upload fails - Check internet connection, zip still available locally