Repository navigation
Faststrap v0.5.1
Faststrap v0.5.1 – Simpler Static Assets Mounting 🎉
What's New
mount_assets() Helper Function
We've added a clean, one-line solution for mounting static files — goodbye boilerplate!
Before (manual & verbose):
from starlette.staticfiles import StaticFiles
from starlette.routing import Mount
import os
assets_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets")
app.routes.insert(0, Mount("/assets", StaticFiles(directory=assets_path), name="assets"))After (clean & simple):
from faststrap import mount_assets
mount_assets(app, "assets") # That's it! 🎉Key Features of mount_assets()
- ✅ Smart path resolution — automatically detects your app's directory
- ✅ Built-in validation — checks if the directory exists before mounting
- ✅ Auto-naming — generates sensible mount names from URL paths
- ✅ Multiple directories support — mount as many folders as needed
- ✅ Flexible — works with both relative and absolute paths
Usage Examples
from fasthtml.common import FastHTML
from faststrap import add_bootstrap, mount_assets
app = FastHTML()
add_bootstrap(app)
# Basic usage – mounts assets/ at /assets/
mount_assets(app, "assets")
# Custom URL path
mount_assets(app, "images", url_path="/img")
mount_assets(app, "uploads", url_path="/uploads")
# Using an absolute path
mount_assets(app, "/var/www/static", url_path="/files")🐛 Bug Fixes
- Fixed duplicate
animationproperty in.toast-fade-outCSS class
Impact: Low – cosmetic/code-quality fix, no functional change or breaking behavior
📦 Installation
Fresh install
pip install faststrap==0.5.1Upgrade from v0.5.0
pip install --upgrade faststrapBreaking Changes: None — fully backward-compatible release.
✅ Quality Assurance
- 423 tests passing ✅
- Code quality checks:
ruff✅black✅mypy✅ - Test coverage: 85%+
- 10 new tests written specifically for the
mount_assets()function
📚 Documentation
Comprehensive docstrings are now included:
from faststrap import mount_assets
help(mount_assets)🔄 Migration Guide
If you were manually mounting static files:
Old code:
from starlette.staticfiles import StaticFiles
from starlette.routing import Mount
import os
assets_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets")
app.routes.insert(0, Mount("/assets", StaticFiles(directory=assets_path), name="assets"))New code:
from faststrap import mount_assets
mount_assets(app, "assets")If you were using FastHTML's built-in static_dir:
No changes required — both approaches work side-by-side:
# Option 1: FastHTML native (served at root /)
app = FastHTML(static_dir="assets")
# Option 2: Faststrap helper (served at /assets/)
app = FastHTML()
mount_assets(app, "assets")🎁 What's Next?
See the ROADMAP for v0.6.0 highlights:
- Data layer:
Table.from_df()(Pandas/Polars support) - Productivity:
Form.from_pydantic() - Auth components:
LoginCard,SignupForm - Realtime: SSE wrappers
📊 Project Stats
- 51 components across 6 categories
- 320+ tests with 85%+ coverage
- 100% parity with Bootstrap 5.3.3
- Zero custom JavaScript required
- 10 built-in themes
🙏 Contributors & Thanks
Thank you to everyone who reported issues, gave feedback, and contributed!
Special thanks to the FastHTML community for the continued support and inspiration.
📝 Full Changelog
See the complete list of changes in CHANGELOG.md.
🔗 Useful Links
- Documentation: https://faststrap-org.github.io/Faststrap/
- GitHub Repository: https://github.com/Faststrap-org/Faststrap
- PyPI: https://pypi.org/project/faststrap/
- Discord: FastHTML Community
💬 Feedback & Issues
Found a bug? Have a feature idea? Please open an issue on GitHub — we read every one.
Happy coding with Faststrap! 🚀