Tailwind (tailwind v0.1.3) View Source

Tailwind is an installer and runner for tailwind.

Profiles

You can define multiple tailwind profiles. By default, there is a profile called :default which you can configure its args, current directory and environment:

config :tailwind,
  version: "3.0.10",
  default: [
    args: ~w(
      --config=tailwind.config.js
      --input=css/app.css
      --output=../priv/static/assets/app.css
    ),
    cd: Path.expand("../assets", __DIR__),
  ]

Tailwind configuration

There are two global configurations for the tailwind application:

  • :version - the expected tailwind version

  • :path - the path to find the tailwind executable at. By default, it is automatically downloaded and placed inside the _build directory of your current app

Overriding the :path is not recommended, as we will automatically download and manage tailwind for you. But in case you can't download it (for example, GitHub behind a proxy), you may want to set the :path to a configurable system location.

For instance, you can install tailwind globally with npm:

$ npm install -g tailwind

On Unix, the executable will be at:

NPM_ROOT/tailwind/node_modules/tailwind-TARGET/bin/tailwind

On Windows, it will be at:

NPM_ROOT/tailwind/node_modules/tailwind-windows-(32|64)/tailwind.exe

Where NPM_ROOT is the result of npm root -g and TARGET is your system target architecture.

Once you find the location of the executable, you can store it in a MIX_TAILWIND_PATH environment variable, which you can then read in your configuration file:

config :tailwind, path: System.get_env("")

The first time this package is installed, a default tailwind configuration will be placed in a new assets/tailwind.config.js file. See the tailwind documentation on configuration options.

Note: The stand-alone Tailwind client bundles first-class tailwind packages within the precompiled executable. For third-party Tailwind plugin support, the node package must be used. See the tailwind nodejs installation instructions if you require third-party plugin support.

Link to this section Summary

Functions

Returns the path to the executable.

Returns the version of the tailwind executable.

Returns the configuration for the given profile.

Returns the configured tailwind version.

Installs tailwind with configured_version/0.

Installs, if not available, and then runs tailwind.

Runs the given command with args.

Link to this section Functions

Returns the path to the executable.

The executable may not be available if it was not yet installed.

Returns the version of the tailwind executable.

Returns {:ok, version_string} on success or :error when the executable is not available.

Returns the configuration for the given profile.

Returns nil if the profile does not exist.

Returns the configured tailwind version.

Installs tailwind with configured_version/0.

Link to this function

install_and_run(profile, args)

View Source

Installs, if not available, and then runs tailwind.

Returns the same as run/2.

Link to this function

run(profile, extra_args)

View Source

Runs the given command with args.

The given args will be appended to the configured args. The task output will be streamed directly to stdio. It returns the status of the underlying call.