Flask Assets
from flask_assets import Bundle
# Create a bundle for CSS and JavaScript
css_bundle = Bundle('styles.css')
js_bundle = Bundle('scripts.js')
# Register the bundles with the Flask application
app.config['ASSETS_DEBUG'] = True
assets_env.register('css_all', css_bundle)
assets_env.register('js_all', js_bundle)# Cache assets for one year
app.config['ASSETS_CACHE'] = True
app.config['ASSETS_CACHE_MAX_AGE'] = 60 * 60 * 24 * 365# Compress CSS and JavaScript assets
app.config['ASSETS_COMPRESSOR'] = 'flask_assets.compressors.GzipCompressor'