Summary
Functions
Mix-alias-compatible function which can be used during assets.build to post-process CSS for auto-prefixing, nesting, imports, etc.
Watcher that can be installed in config/dev.exs to run PostCSS in watch mode and re-process CSS whenever styles change.
If PostCSS install directory needs to be specified separately from build, a different path (relative to project root directory) can be passed here
Functions
Mix-alias-compatible function which can be used during assets.build to post-process CSS for auto-prefixing, nesting, imports, etc.
In mix.exs, add to assets.build alias, eg.
defp aliases do
[
...,
"assets.build":
["compile", &Coloco.PostCSS.build/1, "esbuild example_application"],
...,
]end
If PostCSS is installed in a directory other than 'assets', specify install directory (relative to project root directory) in your config/dev.exs:
config :coloco, postcss_install_path: "path/to/postcss/dir"
Watcher that can be installed in config/dev.exs to run PostCSS in watch mode and re-process CSS whenever styles change.
In config/dev.exs, add the following to :watchers list under Endpoint config:
config :example_application, ExampleApplication.Endpoint
...,
watchers: [
...,
postcss: {Coloco.PostCSS, :watcher, []},
...,
]
If PostCSS install directory needs to be specified separately from build, a different path (relative to project root directory) can be passed here:
postcss: {Coloco.PostCSS, :watcher, [postcss_install_path: "path/to/postcss/dir"]}