Combo.Static (combo v0.8.0)

View Source

Manages the static files.

It is responsible for:

  • generating the manifest file of static files.
  • managing the cache of static files.

Configurations

  • :manifest - a path to a JSON manifest file. This is typically set to "priv/static/manifest.digest.json" which is the file generated by mix combo.static.digest. It can be either a string containing a file system path, or a tuple containing the application name and the path within that application. Default to nil.

  • :vsn - when true, adds query string "?vsn=d" to the generated paths. This query string is used by Plug.Static to set long expiry dates. Therefore, if you are not using Plug.Static to serve assets (for example, you are using a CDN), you should set this config to false, and you should also consider passing --no-vsn to mix combo.static.digest. Defaults to true.

  • :compressors - the list of compressors. Default to [Combo.Static.Compressor.Gzip].

  • :compressible_extensions - the list of compressible file extensions. Default to [".js", ".map", ".css", ".txt", ".text", ".html", ".json", ".svg", ".eot", ".ttf"].

Note

To prevent a race condition where the socket listener is already started but the static is not ready, this module should be started as a child in the supervision tree of endpoint.

Summary

Functions

Lists the extensions of compressible files.

Lists the compressors.

Functions

child_spec(arg)

compressible_extensions()

@spec compressible_extensions() :: [String.t()]

Lists the extensions of compressible files.

compressors()

@spec compressors() :: [module()]

Lists the compressors.

lookup(endpoint, path)

start_link(arg)