-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathremove_var.rs
More file actions
25 lines (22 loc) · 1.73 KB
/
remove_var.rs
File metadata and controls
25 lines (22 loc) · 1.73 KB
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
// ┌───────────────────────────────────────────────────────────────────────────┐
// │ │
// │ ██████╗ ██████╗ ██████╗ Copyright (C) 2022, The Prospective Company │
// │ ██╔══██╗██╔══██╗██╔═══██╗ │
// │ ██████╔╝██████╔╝██║ ██║ This file is part of the Procss library, │
// │ ██╔═══╝ ██╔══██╗██║ ██║ distributed under the terms of the │
// │ ██║ ██║ ██║╚██████╔╝ Apache License 2.0. The full license can │
// │ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ be found in the LICENSE file. │
// │ │
// └───────────────────────────────────────────────────────────────────────────┘
use crate::ast::Ruleset::{self};
use crate::ast::*;
pub fn remove_var(css: &mut Css) {
let reduced = css
.iter()
.filter(|&ruleset| match ruleset {
Ruleset::QualRule(QualRule(_, Some(val))) if val.strip_prefix(':').is_some() => false,
_ => true,
})
.cloned();
*css = crate::ast::Css(reduced.collect())
}