drop redundant feature flags, as behavour is consistent between sass syntax types
This commit is contained in:
parent
4fb3b5db7f
commit
75981d83a7
10 changed files with 6 additions and 66 deletions
14
Cargo.toml
14
Cargo.toml
|
|
@ -43,22 +43,10 @@ sabry_build = {workspace = true, optional = true}
|
|||
sabry_intrnl = {workspace = true}
|
||||
|
||||
[features]
|
||||
default = ["scss"]
|
||||
default = ["procmacro"]
|
||||
procmacro = [
|
||||
"dep:sabry_procmacro"
|
||||
]
|
||||
sass = [
|
||||
"procmacro",
|
||||
"sabry_procmacro/sass",
|
||||
"sabry_intrnl/sass",
|
||||
"sabry_build/sass"
|
||||
]
|
||||
scss = [
|
||||
"procmacro",
|
||||
"sabry_procmacro/scss",
|
||||
"sabry_intrnl/scss",
|
||||
"sabry_build/scss"
|
||||
]
|
||||
build = [
|
||||
"dep:sabry_build"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ rust-version = "1.82"
|
|||
publish = false
|
||||
|
||||
[dependencies]
|
||||
sabry = {path = "../../", features = ["sass"]}
|
||||
sabry = {path = "../../"}
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ tracing = { version = "0.1", optional = true }
|
|||
http = "1"
|
||||
|
||||
# sabry with sass
|
||||
sabry = {path = "../../", features = ["sass"]}
|
||||
sabry = {path = "../../"}
|
||||
|
||||
[build-dependencies]
|
||||
# sabry for build with sass
|
||||
sabry = {path = "../../", features = ["build", "sass"]}
|
||||
sabry = {path = "../../", features = ["build"]}
|
||||
# lets depend on our styles
|
||||
define-styles = {path = "../define-styles"}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ rust-version = "1.82"
|
|||
publish = false
|
||||
|
||||
[dependencies]
|
||||
sabry = {path = "../../", features = ["sass"]}
|
||||
sabry = {path = "../../"}
|
||||
|
||||
[build-dependencies]
|
||||
sabry = {path = "../../", features = ["build", "sass"]}
|
||||
sabry = {path = "../../", features = ["build"]}
|
||||
define-styles = {path = "../define-styles"}
|
||||
|
||||
[package.metadata.sabry]
|
||||
|
|
|
|||
|
|
@ -17,12 +17,4 @@ thiserror = {version = "^1.0"}
|
|||
walkdir = {version = "^2.5"}
|
||||
|
||||
[features]
|
||||
sass = [
|
||||
"sabry_procmacro_impl/sass",
|
||||
"sabry_intrnl/sass"
|
||||
]
|
||||
scss = [
|
||||
"sabry_procmacro_impl/scss",
|
||||
"sabry_intrnl/scss"
|
||||
]
|
||||
net-files = []
|
||||
|
|
|
|||
|
|
@ -24,5 +24,3 @@ serde = {version = "^1.0", features = ["derive"]}
|
|||
toml = {version = "^0.8"}
|
||||
|
||||
[features]
|
||||
sass = []
|
||||
scss = []
|
||||
|
|
|
|||
|
|
@ -89,18 +89,14 @@ pub enum SabryCompilerError {
|
|||
/// Unification wrapper over all the Syntax enums
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum CompilerSyntax {
|
||||
#[cfg(feature = "sass")]
|
||||
Sass,
|
||||
#[cfg(feature = "scss")]
|
||||
Scss,
|
||||
}
|
||||
|
||||
impl From<raffia::Syntax> for CompilerSyntax {
|
||||
fn from(value: raffia::Syntax) -> Self {
|
||||
match value {
|
||||
#[cfg(feature = "sass")]
|
||||
raffia::Syntax::Sass => Self::Sass,
|
||||
#[cfg(feature = "scss")]
|
||||
raffia::Syntax::Scss => Self::Scss,
|
||||
// TODO: fallbacky error-prone
|
||||
_ => Self::Scss,
|
||||
|
|
@ -111,9 +107,7 @@ impl From<raffia::Syntax> for CompilerSyntax {
|
|||
impl From<CompilerSyntax> for grass::InputSyntax {
|
||||
fn from(value: CompilerSyntax) -> Self {
|
||||
match value {
|
||||
#[cfg(feature = "scss")]
|
||||
CompilerSyntax::Scss => Self::Scss,
|
||||
#[cfg(feature = "sass")]
|
||||
CompilerSyntax::Sass => Self::Sass,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,3 @@ proc-macro = true
|
|||
sabry_procmacro_impl = {workspace = true}
|
||||
|
||||
[features]
|
||||
sass = [
|
||||
"sabry_procmacro_impl/sass"
|
||||
]
|
||||
scss = [
|
||||
"sabry_procmacro_impl/scss"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -17,9 +17,3 @@ raffia = {version = "^0.9"}
|
|||
regex = {version = "^1.11"}
|
||||
|
||||
[features]
|
||||
sass = [
|
||||
"sabry_intrnl/sass"
|
||||
]
|
||||
scss = [
|
||||
"sabry_intrnl/scss"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -74,18 +74,14 @@ impl ToString for ArbitraryStyleBlock {
|
|||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum ArbitraryStyleSyntax {
|
||||
#[cfg(feature = "scss")]
|
||||
Scss,
|
||||
#[cfg(feature = "sass")]
|
||||
Sass,
|
||||
}
|
||||
|
||||
impl From<ArbitraryStyleSyntax> for CompilerSyntax {
|
||||
fn from(value: ArbitraryStyleSyntax) -> Self {
|
||||
match value {
|
||||
#[cfg(feature = "sass")]
|
||||
ArbitraryStyleSyntax::Sass => Self::Sass,
|
||||
#[cfg(feature = "scss")]
|
||||
ArbitraryStyleSyntax::Scss => Self::Scss,
|
||||
}
|
||||
}
|
||||
|
|
@ -94,9 +90,7 @@ impl From<ArbitraryStyleSyntax> for CompilerSyntax {
|
|||
impl ToTokens for ArbitraryStyleSyntax {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
match self {
|
||||
#[cfg(feature = "sass")]
|
||||
Self::Sass => tokens.append_all(quote! {"sass"}),
|
||||
#[cfg(feature = "scss")]
|
||||
Self::Scss => tokens.append_all(quote! {"scss"}),
|
||||
}
|
||||
}
|
||||
|
|
@ -114,9 +108,7 @@ impl Parse for ArbitraryStyleSyntax {
|
|||
let ident = input.parse::<Ident>()?;
|
||||
|
||||
match ident.to_string().as_str() {
|
||||
#[cfg(feature = "sass")]
|
||||
"sass" => Ok(Self::Sass),
|
||||
#[cfg(feature = "scss")]
|
||||
"scss" => Ok(Self::Scss),
|
||||
_ => Err(syn::Error::new(
|
||||
ident.span(),
|
||||
|
|
@ -132,9 +124,7 @@ impl Parse for ArbitraryStyleSyntax {
|
|||
impl Debug for ArbitraryStyleSyntax {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let name = match self {
|
||||
#[cfg(feature = "sass")]
|
||||
Self::Sass => "sass",
|
||||
#[cfg(feature = "scss")]
|
||||
Self::Scss => "scss",
|
||||
};
|
||||
write!(f, "{name}")
|
||||
|
|
@ -142,23 +132,15 @@ impl Debug for ArbitraryStyleSyntax {
|
|||
}
|
||||
|
||||
impl Default for ArbitraryStyleSyntax {
|
||||
#[cfg(feature = "scss")]
|
||||
fn default() -> Self {
|
||||
Self::Scss
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "sass", not(feature = "scss")))]
|
||||
fn default() -> Self {
|
||||
Self::Sass
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ArbitraryStyleSyntax> for raffia::Syntax {
|
||||
fn from(value: ArbitraryStyleSyntax) -> Self {
|
||||
match value {
|
||||
#[cfg(feature = "sass")]
|
||||
ArbitraryStyleSyntax::Sass => Self::Sass,
|
||||
#[cfg(feature = "scss")]
|
||||
ArbitraryStyleSyntax::Scss => Self::Scss,
|
||||
}
|
||||
}
|
||||
|
|
@ -166,7 +148,6 @@ impl From<ArbitraryStyleSyntax> for raffia::Syntax {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
#[cfg(feature = "sass")]
|
||||
#[test]
|
||||
fn arbitrary_style_block_sass() {
|
||||
use super::ArbitraryStyleBlock;
|
||||
|
|
@ -183,7 +164,6 @@ mod test {
|
|||
assert_eq!(code, block.code);
|
||||
}
|
||||
|
||||
#[cfg(feature = "scss")]
|
||||
#[test]
|
||||
fn arbitrary_style_block_scss() {
|
||||
use super::ArbitraryStyleBlock;
|
||||
|
|
|
|||
Loading…
Reference in a new issue