Pylibsass API

This section of the documentation provides an introduction to all of the pylibsass interface. All of the important stuff should be here. If there is something missing, the source code is available on GitHub <

Main Interface

The major functions will be exposed directly through the main pylibsass package., dest_path)

Watches for filesystem changes and compiles SCSS to CSS

This is an async function.

  • source_path (str) – The source directory to watch. All .scss files are monitored.
  • dest_path (str) – The destination directory where the resulting CSS files should go. The filename will be identical to the original, except the extension will be .css.

Lower-Level Interface

The lower-level interface is used by the main interface. If you need to do something weird, these functions will be useful. These typically interact directly with libsass.


Compiles a SASS string

Parameters:contents (str) – The SASS contents to compile
Returns:The compiled CSS
class pylibsass.sass.LibSass[source]

Wrapper class around libsass.

The class provides methods that mimic the functions in sass_interface.h


Compiles a string to CSS

This calls the sass_compile function.

:param pylibsass.sass.SassContext ctx: The libsass context


Compiles a file to CSS

This calls the sass_compile_file function.

:param pylibsass.sass.SassFileContext ctx: The libsass context


Compiles a folder to CSS

This calls the sass_compile_folder function.

:param pylibsass.sass.SassFolderContext ctx: The libsass context


Gets a new sass context object.

This calls the sass_new_context() function.


Gets a new sass file context object.

This calls the sass_new_file_context() function.


Gets a new sass folder context object.

This calls the sass_new_folder_context() function.

C Structs

The C structs are ctypes definitions for the libsass structs. See the libsass project documentation for more information.

class pylibsass.sass.SassContext[source]
class pylibsass.sass.SassFileContext[source]
class pylibsass.sass.SassFolderContext[source]

Project Versions

Table Of Contents

Previous topic


This Page