Django mixin and view#
Mixin#
- class py_css_styleguide.django.mixin.StyleguideMixin[source]#
A mixin to return a manifest object.
- resolve_css_filepath(path)[source]#
Validate path or resolve static filepath if needed.
- Parameters:
path (string) – Either an absolute path or a relative path to an enabled static directory.
- Returns:
Resolved path if success, else return None.
- Return type:
string
- get_css_manifest(manifest, path, json_filepath=None, save_dump=False)[source]#
From given path, load CSS with manifest model and possibly save it if required.
- Parameters:
manifest (py_css_styleguide.model.Manifest) – Manifest model object to use to parse CSS manifest.
path (string) – Path to the CSS manifest. If this is a relative path, it is assumed it is a file inside static directory to resolve by Django static finder. Give a full absolute path if your file is out of the enabled static directories.
- Keyword Arguments:
json_filepath (string) – Absolute filepath for JSON dump destination. If empty, no dump will be created.
save_dump (boolean) – To enable manifest JSON dump write. This can only works if CSS manifest has been correctly loaded.
- Returns:
- The manifest object with loaded
references.
- Return type:
- get_json_manifest(manifest, path)[source]#
From given path, load JSON manifest dump.
- Parameters:
manifest (py_css_styleguide.model.Manifest) – Manifest model object to use to parse CSS manifest.
path (string) – Path to the CSS manifest.
- Returns:
- The manifest object with loaded
references.
- Return type:
- get_manifest(css_filepath, json_filepath=None, save_dump=True, development_mode=True)[source]#
Get and load manifest, either from CSS or JSON file depending options.
- Parameters:
css_filepath (string) – Path to CSS manifest file. Either an absolute path or a relative path to an enabled static directory.
- Keyword Arguments:
json_filepath (string) – Path to JSON manifest (to read or write).
save_dump (boolean) – To enable manifest JSON dump write. This can only works if CSS manifest has been correctly loaded and
json_filepath
has been given.development_mode (boolean) – In development mode, CSS manifest is readed if it exists then a JSON dump may be written depending
save_dump
.
- Returns:
Manifest object.
- Return type: