sassutils.builder — Build the whole directory

sassutils.builder.SUFFIXES = frozenset({'sass', 'scss'})

(collections.Set) The set of supported filename suffixes.

sassutils.builder.SUFFIX_PATTERN = re.compile('[.](sass|scss)$')

(re.RegexObject) The regular expression pattern which matches to filenames of supported SUFFIXES.

class sassutils.builder.Manifest(sass_path, css_path=None, wsgi_path=None)

Building manifest of SASS/SCSS.

Parameters:
  • sass_path (str, basestring) – the path of the directory that contains SASS/SCSS source files
  • css_path (str, basestring) – the path of the directory to store compiled CSS files
build(package_dir, output_style='nested')

Builds the SASS/SCSS files in the specified sass_path. It finds sass_path and locates css_path as relative to the given package_dir.

Parameters:
  • package_dir (str, basestring) – the path of package directory
  • output_style (str) – an optional coding style of the compiled result. choose one of: 'nested' (default), 'expanded', 'compact', 'compressed'
Returns:

the set of compiled CSS filenames

Return type:

collections.Set

New in version 0.6.0: The output_style parameter.

build_one(package_dir, filename, source_map=False)

Builds one SASS/SCSS file.

Parameters:
  • package_dir (str, basestring) – the path of package directory
  • filename (str, basestring) – the filename of SASS/SCSS source to compile
  • source_map (bool) – whether to use source maps. if True it also write a source map to a filename followed by .map suffix. default is False
Returns:

the filename of compiled CSS

Return type:

str, basestring

New in version 0.4.0: Added optional source_map parameter.

resolve_filename(package_dir, filename)

Gets a proper full relative path of SASS source and CSS source that will be generated, according to package_dir and filename.

Parameters:
  • package_dir (str, basestring) – the path of package directory
  • filename (str, basestring) – the filename of SASS/SCSS source to compile
Returns:

a pair of (sass, css) path

Return type:

tuple

sassutils.builder.build_directory(sass_path, css_path, output_style='nested', _root_sass=None, _root_css=None)

Compiles all SASS/SCSS files in path to CSS.

Parameters:
  • sass_path (str, basestring) – the path of the directory which contains source files to compile
  • css_path (str, basestring) – the path of the directory compiled CSS files will go
  • output_style (str) – an optional coding style of the compiled result. choose one of: 'nested' (default), 'expanded', 'compact', 'compressed'
Returns:

a dictionary of source filenames to compiled CSS filenames

Return type:

collections.Mapping

New in version 0.6.0: The output_style parameter.