Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

lua-sass

Lua bindings for libsass.

Requirements

Installation

luarocks install sass

Usage

The sass module provides 2 functions, which are named in accordance with their libsass counterparts:

compile

local css, err = sass.compile(scss, style)

Parameters:

  1. scss: A string of SCSS input text.
  2. style: The output style. Either "nested"or "compressed" (optional; defaults to "nested").

Returns:

Either a string of CSS on success, or nil and an error message on failure.

compile_file

local css, err = sass.compile_file(filename, style)

Parameters:

  1. filename: An SCSS file to read input from.
  2. As above.

Returns:

As above.

Examples

Compiling a string and using the assert idiom for error handling:

local sass = require "sass"
local css = assert(sass.compile "$x: red; div {color: $x}")
print(css)

Compiling a file and using explicit error handling:

local sass = require "sass"
local css, err = sass.compile_file("file.scss", "nested")
if css then
    io.stdout:write(css)
else
    io.stderr:write(err)
    os.exit(1)
end
You can’t perform that action at this time.