class

BunBunBundle::DevAssetCacheHandler

Inherits HTTP::Handler < Reference < Object

Prevents browser caching of assets in development.

Sets no-cache headers on requests for static asset files so that changes are picked up immediately during development.

# Kemal:
add_handler BunBunBundle::DevAssetCacheHandler.new

# Plain Crystal HTTP::Server:
server = HTTP::Server.new([
  BunBunBundle::DevAssetCacheHandler.new,
  # ...
])

Constants

ASSET_EXTENSIONS = [".js", ".css", ".map", ".json", ".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp", ".avif", ".woff", ".woff2", ".ttf", ".eot"] of ::String

Instance methods

call(context : HTTP::Server::Context) : Nil