1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! This module defines the `CssOptimizer` trait, which provides an interface for optimizing raw CSS.
//!
//! Implementations of this trait are responsible for taking raw CSS input and producing optimized,
//! minified output. The specific optimization techniques are left to the implementation details.
//! This trait allows for different optimization backends to be easily swapped or replaced within the system.
use GrimoireCssError;
/// The `CssOptimizer` trait provides an interface for optimizing CSS.
///
/// This trait is designed to be implemented by different CSS optimization engines. Implementations
/// of this trait can apply various techniques to minify, clean up, or otherwise optimize raw CSS code.
///
/// # Example
///
/// ```ignore
/// struct MyOptimizer;
///
/// impl CssOptimizer for MyOptimizer {
/// fn optimize(&self, raw_css: &str) -> Result<String, GrimoireCSSError> {
/// // Perform optimization here
/// Ok(minified_css)
/// }
/// }
/// ```
///
/// # Errors
///
/// This method returns a `GrimoireCSSError` if the optimization process fails for any reason.