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
55
56
57
58
59
60
61
62
63
use Utf8PathBuf;
use ;
use crate::;
/// Represents a compiled CSS asset emitted by the build pipeline.
///
/// This struct contains only the path to the minified stylesheet,
/// which can be included in HTML templates or referenced from other assets.
/// Constructs a loader that compiles all `.scss` files matching the given glob pattern.
///
/// Uses [`grass`] (a Sass compiler in Rust) to compile matched files with compressed
/// output style. Each compiled result is hashed for content-based caching and stored
/// as a `.css` file. The resulting [`Style`] contains a path to the compiled stylesheet.
///
/// ### Parameters
/// - `path_base`: Base directory used for resolving relative paths.
/// - `path_glob`: Glob pattern to select `.scss` files within `path_base`.
///
/// ### Returns
/// A [`Loader`] that emits [`Style`] objects keyed by file path and content hash.
///
/// ### Example
/// ```rust
/// use hauchiwa::{Context, TaskResult, Page, loader::{Style, glob_styles}};
///
/// // loader
/// let loader = glob_styles("src/styles", "**/*.scss");
///
/// // task
/// fn task(ctx: Context) -> TaskResult<Vec<Page>> {
/// let Style { path } = ctx.get::<Style>("styles.scss")?;
///
/// Ok(vec![
/// Page::text("index.html".into(), format!("<link rel='stylesheet' href='{path}'>"))
/// ])
/// }
/// ```