service
dev_tool.services.sass.service
log = logging.getLogger(__name__)
module-attribute
SassService
Bases: BaseService
A service class for Sass/SCSS operations.
This class provides methods for compiling SCSS stylesheets to CSS and for watching source stylesheets during development.
The constructor for the SassService class.
Parameters:
-
runner(CommandRunnerProtocol) –The command runner for executing commands.
-
bun(BunService) –The Bun service, used to provision sass on the host.
-
config(dict[str, Any] | None, default:None) –The configuration dictionary for Sass settings.
Source code in dev_tool/services/sass/service.py
runner = runner
instance-attribute
bun = bun
instance-attribute
config = config or {}
instance-attribute
source_directories = self.config.get('source_directories', ['static/scss'])
instance-attribute
output_directory = self.config.get('output_directory', 'static/css')
instance-attribute
style = self.config.get('style', 'expanded')
instance-attribute
source_map = self.config.get('source_map', True)
instance-attribute
compile_styles
A method that compiles SCSS stylesheets to CSS.
Parameters:
-
production(bool, default:False) –Whether to compile with production settings.
Raises:
-
SassCompileError–If compilation fails.
Source code in dev_tool/services/sass/service.py
create_runner
A method that creates a Sass watcher runner.
Returns:
-
SassWatcherRunner | None–A watcher runner if source directories exist, None otherwise.
Source code in dev_tool/services/sass/service.py
ensure_available
A method that ensures sass is available, installing it on the host if needed.
In containerized mode sass is provided by the app container, so no host installation is performed.
Returns:
-
bool–True if sass is available (or running in a container), False otherwise.
Source code in dev_tool/services/sass/service.py
is_available
A method that checks if Sass is available.
Returns:
-
bool–True if Sass is available, False otherwise.