SassEx

Sass compiler for Elixir that uses the newer Dart Sass.

Installation

The package is available in Hex and can be installed by adding sass_ex to your list of dependencies in mix.exs:

def deps do
  [
    {:sass_ex, "~> 0.1"}
  ]
end

Documentation can be found at https://hexdocs.pm/sass_ex.

Basic Usage

iex> SassEx.compile(".example { color: red; }")
{:ok, %SassEx.Response{css: ".example {\n  color: red;\n}", source_map: ""}}

Custom importers

SassEx was built with the ability to have custom importers from the start. Custom importers allow you to load @imported files from places other than the file system. By default, the standard importer loads from the current directory, but this can be changed to either a different path or a custom loader that loads from something like a database.

See the SassEx.Importer documentation for more details at https://hexdocs.pm/sass_ex.

Technical details

SassEx uses Dart Sass under the hood. A copy of Dart Sass is run at startup inside an Elixir/Erlang Port.

See dart-sass-embedded for more details.