Component¶
The Translucent builder component module.
- class confirm.translucent.component.Component(path, version)¶
The representation of a template component, with helper attributes & methods to access a component’s properties such as the template, style or script.
- Parameters:
path (pathlib.Path) – The path to the component directory
version (str) – The version of Translucent
- property has_script¶
Checks if a custom JavaScript exists for the component, by verifying the existence of the
self.script_path
.- Returns:
Script existence
- Return type:
bool
- property has_story¶
Checks if a story exists for the component, by verifying the existence of the
self.story_path
.- Returns:
Style existence
- Return type:
bool
- property has_style¶
Checks if a custom CSS style exists for the component, by verifying the existence of the
self.style_path
.- Returns:
Style existence
- Return type:
bool
- static read_file(path)¶
Read the content of the
path
on the filesystem.- Parameters:
path (str) – The path to a file
- Returns:
The file content
- Return type:
str
- property script¶
The custom JavaScript of the component, fetched from the
self.script_path
.- Returns:
The script
- Return type:
str
- property style¶
The custom CSS style of the component, fetched from the
self.style_path
.- Returns:
The style
- Return type:
str
- property template¶
The HTML template of the component, fetched from the
self.template_path
.- Returns:
The template
- Return type:
str