Laravel plugin for Vite that enables seamless integration between Laravel applications and Vite's build tooling with SSR support and Inertia.js helpers
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
CLI tools and utilities for managing compiled assets, including cleanup of orphaned files that are no longer referenced in Vite manifests.
Command-line tool for removing orphaned assets that are no longer referenced in the Vite manifest files.
# Basic usage
clean-orphaned-assets
# With custom manifest path
clean-orphaned-assets --manifest=./custom/path/manifest.json
# For SSR builds
clean-orphaned-assets --ssr
# With custom assets directory
clean-orphaned-assets --assets=./public/assets
# Dry run to see what would be removed
clean-orphaned-assets --dry-run
# Quiet mode (suppress output)
clean-orphaned-assets --quietComplete command-line options for the asset cleanup tool:
--manifest=<path> # Specify custom manifest file path
--ssr # Use SSR manifest file locations
--assets=<path> # Specify custom assets directory path
--dry-run # Preview what would be removed without deleting
--quiet # Suppress all output messagesDefault Behavior:
./public/build/manifest.json./bootstrap/ssr/ssr-manifest.json and ./bootstrap/ssr/manifest.json/assets (e.g., ./public/build/assets)Usage Examples:
# Clean regular build assets
clean-orphaned-assets
# Clean SSR build assets
clean-orphaned-assets --ssr
# Preview what would be cleaned without actually deleting
clean-orphaned-assets --dry-run
# Clean with custom paths
clean-orphaned-assets \
--manifest=./dist/manifest.json \
--assets=./dist/assets
# Silent cleanup for CI/CD scripts
clean-orphaned-assets --quietThe asset cleanup tool processes different types of Vite manifests:
Standard Vite manifest format with asset references:
{
"resources/js/app.js": {
"file": "assets/app-abc123.js",
"src": "resources/js/app.js",
"isEntry": true,
"css": ["assets/app-def456.css"]
}
}Server-side rendering manifest with array format:
{
"resources/js/ssr.js": [
"assets/ssr-abc123.js",
"assets/shared-def456.js"
]
}The cleanup process follows these steps:
The asset cleanup tool can be integrated into your build workflow:
{
"scripts": {
"build": "vite build",
"build:clean": "vite build && clean-orphaned-assets",
"build:ssr": "vite build --ssr && clean-orphaned-assets --ssr",
"clean:assets": "clean-orphaned-assets",
"clean:preview": "clean-orphaned-assets --dry-run"
}
}#!/bin/bash
# Build assets
npm run build
# Clean orphaned assets quietly
clean-orphaned-assets --quiet
# Verify build completed successfully
if [ $? -eq 0 ]; then
echo "Build and cleanup completed successfully"
else
echo "Build or cleanup failed"
exit 1
fiThe cleanup tool includes several safety mechanisms:
Reading manifest [./public/build/manifest.json].
Non-SSR manifest found.
Verify assets in [./public/build/assets].
[3] orphaned assets found.
Removing orphaned asset [./public/build/assets/old-file-123.js].
Removing orphaned asset [./public/build/assets/unused-456.css].
Removing orphaned asset [./public/build/assets/legacy-789.png].Reading manifest [./public/build/manifest.json].
Non-SSR manifest found.
Verify assets in [./public/build/assets].
[2] orphaned assets found.
Orphaned asset [./public/build/assets/old-file-123.js] would be removed.
Orphaned asset [./public/build/assets/unused-456.css] would be removed.Reading manifest [./public/build/manifest.json].
Non-SSR manifest found.
Verify assets in [./public/build/assets].
No orphaned assets found.