CSSEx (CSSEx v0.6.6) View Source

CSSEx is a CSS pre-processor inspired by SASS/SCSS. A complete description of what it can do can be found in the project's README.md hex / github file.

This module is the file watcher responsible for automatically processing your CSSEx files into proper CSS files. Refer to the usage section for details.

Link to this section Summary

Functions

Generate a %CSSEx{} struct from a keyword list or a map. Its only relevant use case is to "parse" app config environment values. You can also pass a directory as the last argument where it will be joined to the paths in the :entry_points. Whatever the final path it will be expanded when this config is passed as the argument to start_link/1

Start a watcher responsible for automatically processing cssex files into css files. Define in the application config something as

Link to this section Types

Specs

t() :: %CSSEx{
  dependency_graph: term(),
  entry_points: [Keyword.t()],
  file_watch: boolean(),
  monitors: term(),
  no_start: boolean(),
  pretty_print: boolean(),
  reply_to: term(),
  reprocess: term(),
  watchers: term()
}

Link to this section Functions

Link to this function

make_config(opts, dir \\ nil)

View Source

Specs

make_config(Keyword.t() | Map.t(), base_dir :: String.t()) :: %CSSEx{
  dependency_graph: term(),
  entry_points: term(),
  file_watch: term(),
  monitors: term(),
  no_start: term(),
  pretty_print: term(),
  reply_to: term(),
  reprocess: term(),
  watchers: term()
}

Generate a %CSSEx{} struct from a keyword list or a map. Its only relevant use case is to "parse" app config environment values. You can also pass a directory as the last argument where it will be joined to the paths in the :entry_points. Whatever the final path it will be expanded when this config is passed as the argument to start_link/1

Specs

start_link(%CSSEx{
  dependency_graph: term(),
  entry_points: term(),
  file_watch: term(),
  monitors: term(),
  no_start: term(),
  pretty_print: term(),
  reply_to: term(),
  reprocess: term(),
  watchers: term()
}) :: {:ok, pid()} | {:error, term()}

Start a watcher responsible for automatically processing cssex files into css files. Define in the application config something as:

config :yourapp_web, CSSEx,
  entry_points: [
    {"../../../../apps/yourapp_web/assets/cssex/app.cssex", "../../../../apps/yourapp_web/assets/css/app.css"}
]

With as many :entry_points as necessary specified as tuples of {"source", "dest"} Then,

Application.get_env(:yourapp_web, CSSEx)
|> CSSEx.make_config(Application.app_dir(:your_app_web))
|> CSSEx.start_link()

Or add it to a supervision tree. Refer to the README.md file.