View Source PhoenixAssetPipeline.Plug (phoenix_asset_pipeline v1.0.15)

A plug for serving pre-compiled assets and static files.

Options

  • :only - filters which requests to serve. This is useful to avoid file system access on every request when this plug is mounted at "/". For example, if only: ["images", "favicon.ico"] is specified, only files in the "images" directory and the "favicon.ico" file will be served by Plug.Static. Note that Plug.Static matches these filters against request uri and not against the filesystem. When requesting a file with name containing non-ascii or special characters, you should use urlencoded form. For example, you should write only: ["file%20name"] instead of only: ["file name"]. Defaults to nil (no filtering).

  • :only_matching - a relaxed version of :only that will serve any request as long as one of the given values matches the given path. For example, only_matching: ["images", "favicon"] will match any request that starts at "images" or "favicon", be it "/images/foo.png", "/images-high/foo.png", "/favicon.ico" or "/favicon-high.ico". Such matches are useful when serving digested files at the root. Defaults to nil (no filtering).

Summary

Functions

Serves pre-compiled assets.

Serves pre-compiled static files.

Functions

assets(conn, _)

Serves pre-compiled assets.

static(conn, opts)

Serves pre-compiled static files.