Skip to content

Commit 3122b65

Browse files
authored
allow to opt-out from css pure linting (#898)
1 parent b93c9c5 commit 3122b65

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -7111,6 +7111,16 @@ mod tests {
71117111
"@scope(._8Z4fiW_a) to (._8Z4fiW_b){._8Z4fiW_foo{color:red}}",
71127112
pure_css_module_options.clone(),
71137113
);
7114+
minify_test_with_options(
7115+
"/* cssmodules-pure-no-check */ :global(.foo) { color: red }",
7116+
".foo{color:red}",
7117+
pure_css_module_options.clone(),
7118+
);
7119+
minify_test_with_options(
7120+
"/*! some license */ /* cssmodules-pure-no-check */ :global(.foo) { color: red }",
7121+
"/*! some license */\n.foo{color:red}",
7122+
pure_css_module_options.clone(),
7123+
);
71147124

71157125
error_test(
71167126
"input.defaultCheckbox::before h1 {width: 20px}",

src/stylesheet.rs

+5
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ where
172172
cssparser::Token::Comment(comment) if comment.starts_with('!') => {
173173
license_comments.push((*comment).into());
174174
}
175+
cssparser::Token::Comment(comment) if comment.contains("cssmodules-pure-no-check") => {
176+
if let Some(css_modules) = &mut options.css_modules {
177+
css_modules.pure = false;
178+
}
179+
}
175180
_ => break,
176181
}
177182
state = parser.state();

0 commit comments

Comments
 (0)