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 <https://github.com/rsenk330/pylibsass.

Main Interface

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

pylibsass.watch(source_path, dest_path)

Watches for filesystem changes and compiles SCSS to CSS

This is an async function.

Parameters:
  • 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.

pylibsass.sass.compile_str(contents)[source]

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

compile(ctx)[source]

Compiles a string to CSS

This calls the sass_compile function.

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

compile_file(ctx)[source]

Compiles a file to CSS

This calls the sass_compile_file function.

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

compile_folder(ctx)[source]

Compiles a folder to CSS

This calls the sass_compile_folder function.

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

sass_new_context()[source]

Gets a new sass context object.

This calls the sass_new_context() function.

sass_new_file_context()[source]

Gets a new sass file context object.

This calls the sass_new_file_context() function.

sass_new_folder_context()[source]

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

Usage

This Page