This chapter covers the core features and capabilities of Page Speed Optimizer.
# Analyze a single HTML file
python src/page_speed_optimizer.py --analyze examples/sample.html
# Minify HTML
python src/page_speed_optimizer.py --minify examples/sample.html --output index.min.html
# Minify CSS
python src/page_speed_optimizer.py --minify-css style.css --output style.min.css
# Add lazy loading to images
python src/page_speed_optimizer.py --lazy-load index.html --output index.lazy.html
# Audit an entire directory
python src/page_speed_optimizer.py --audit-dir ./dist/ --reportFollow this guide to get Page Speed Optimizer up and running in your environment.
| Flag | Description |
|---|---|
--analyze | Analyze a single HTML file |
--minify | Minify an HTML file |
--minify-css | Minify a CSS file |
--minify-js | Minify a JS file |
--lazy-load | Add lazy loading to an HTML file |
--audit-dir | Audit all assets in a directory |
--report | Generate audit report |
--output, -o | Output file |
--format, -f | Output format: text or json |
--verbose, -v | Enable verbose logging |
See examples/sample.html for a sample landing page to test with.
Get the full Page Speed Optimizer and unlock everything.
Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.
Access all interactive tools with complete data, all workload profiles, and the full scenario library.
Downloadable source code, configuration files, and working examples from every chapter.
Free updates for life. Every new chapter, tool, and improvement included.