View Source PhoenixAssetPipeline.Utils (phoenix_asset_pipeline v1.0.15)

Provides utility functions for the Phoenix Asset Pipeline.

Assets directory

 assets
    css
       app.css
       app.sass
       app.scss
    img
       logo.svg
    js
       app.js
       app.ts
    tailwind.config.js

Static directory

 priv
    static
       apple-touch-icon.png
       android-chrome-192x192.png
       android-chrome-512x512.png
       apple-touch-icon-precomposed.png
       browserconfig.xml
       favicon-16x16.png
       favicon-32x32.png
       favicon.ico
       mstile-150x150.png
       mstile-310x150.png
       mstile-310x310.png
       mstile-70x70.png
       robots.txt
       safari-pinned-tab.svg
       site.webmanifest

Summary

Functions

Returns the paths of the assets.

Returns the Base64 encoded MD5 digest of the content.

Encodes the content using the specified algorithm.

Returns the Base64 encoded SHA-512 digest of the content.

Normalizes the path by removing the trailing slash.

Returns the list of static files.

Returns the priv/static file paths.

Functions

assets_paths()

Returns the paths of the assets.

Examples

assets_paths()

Output

[
  "assets/css/app.css",
  "assets/img/logo.svg",
  "assets/js/app.js"
]

digest(content)

Returns the Base64 encoded MD5 digest of the content.

encode(atom, content)

Encodes the content using the specified algorithm.

Examples

encode(:brotli, content)
encode(:deflate, content)
encode(:gzip, content)

integrity(content)

Returns the Base64 encoded SHA-512 digest of the content.

normalize(path)

Normalizes the path by removing the trailing slash.

static_files()

Returns the list of static files.

Examples

static_files()

Output

[
  {".png", "apple-touch-icon", "<digest>", <data>, <byte_size>},
  {".png.br", "apple-touch-icon", "<digest>", <br_data>, <byte_size>},
  {".png.deflate", "apple-touch-icon", "<digest>", <deflate_data>, <byte_size>},
  {".png.gz", "apple-touch-icon", "<digest>", <gz_data>, <byte_size>},
  ...
]

static_paths()

Returns the priv/static file paths.

Examples

static_paths()

Output

[
  "priv/static/android-chrome-192x192.png",
  "priv/static/android-chrome-512x512.png",
  "priv/static/apple-touch-icon-precomposed.png",
  "priv/static/apple-touch-icon.png",
  "priv/static/browserconfig.xml",
  "priv/static/favicon-16x16.png",
  "priv/static/favicon-32x32.png",
  "priv/static/favicon.ico",
  "priv/static/mstile-150x150.png",
  "priv/static/mstile-310x150.png",
  "priv/static/mstile-310x310.png",
  "priv/static/mstile-70x70.png",
  "priv/static/robots.txt",
  "priv/static/safari-pinned-tab.svg",
  "priv/static/site.webmanifest"
]