dict2css.serializer

Serializer for cascading style sheets.

New in version 0.2.0.

Classes:

CSSSerializer(*[, indent, …])

Serializes a StyleSheet and its parts.

class CSSSerializer(*, indent='\t', trailing_semicolon=False, indent_closing_brace=False, minify=False)[source]

Serializes a StyleSheet and its parts.

This controls the formatting of the style sheet.

Parameters
  • indent (str) – The indent to use, such as a tab (\t), two spaces or four spaces. Default '\t'.

  • trailing_semicolon (bool) – Whether to add a semicolon to the end of the final property. Default False.

  • indent_closing_brace (bool) – Default False.

  • minify (bool) – Minify the CSS. Overrides all other options. Default False.

Methods:

reset_style()

Reset the serializer to its default style.

use()

Contextmanager to use this serializer for the scope of the with block.

reset_style()[source]

Reset the serializer to its default style.

use()[source]

Contextmanager to use this serializer for the scope of the with block.

Return type

Iterator