View Source Sass (sass_compiler v0.1.18)

Compiles SASS into CSS using a NIF for Libsass

Currently supported Sass options

  • output_style integer - use the helpers below to assign the style
  • precision integer - decimal rounding percision
  • source_comments true or false - causes the line number and file where a selector is defined to be emitted into the compiled CSS as a comment
  • soure_map_embed true or false
  • source_map_contents true or false
  • omit_source_map_url true or false
  • is_indented_syntax true or false
  • indent :tab or :space
  • linefeed :unix or :windows
  • include_paths list - list of directories for Sass to search for imports linked files. Example: ["bower_compoents", "../node_modules"]

Link to this section Summary

Functions

Compiles a string of CSS/SCSS/Sass into CSS string

Compiles a file with CSS/SCSS/Sass into CSS string

Prints version of LibSass

Link to this section Functions

Link to this function

compile(source, options \\ %{})

View Source

Compiles a string of CSS/SCSS/Sass into CSS string

Examples

iex> sass = "$white : #fff; a { color: $white;}"
iex> Sass.compile(sass)
{:ok, "a {\n  color: #fff; }\n"}

# With options
iex> Sass.compile(sass, %{output_style: 2})
{:ok, "a { color: #fff; }\n"}
Link to this function

compile_file(path, options \\ %{})

View Source

Compiles a file with CSS/SCSS/Sass into CSS string

Examples

iex> Sass.compile_file("application.scss")
{:ok, "a {\n  color: #fff; }\n"}

# With options
iex> Sass.compile_file("application.scss", %{output_style: 3})
{:ok, "a{color:#fff}\n"}

Prints version of LibSass