{"record":{"id":"5cb0eb5c9657656a","repo":"elkowar/eww","slug":"encountered-both-an-scss-and-css-file-only-one-of","errorCode":null,"errorMessage":"Encountered both an SCSS and CSS file. Only one of these may exist at a time","messagePattern":"Encountered both an SCSS and CSS file\\. Only one of these may exist at a time","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/eww/src/config/scss.rs","lineNumber":14,"sourceCode":"use std::path::Path;\n\nuse anyhow::{anyhow, Context};\n\nuse crate::{error_handling_ctx, util::replace_env_var_references};\n\n/// read an (s)css file, replace all environment variable references within it and\n/// then parse it into css.\n/// Also adds the CSS to the [`crate::file_database::FileDatabase`]\npub fn parse_scss_from_config(path: &Path) -> anyhow::Result<(usize, String)> {\n    let css_file = path.join(\"eww.css\");\n    let scss_file = path.join(\"eww.scss\");\n    if css_file.exists() && scss_file.exists() {\n        return Err(anyhow!(\"Encountered both an SCSS and CSS file. Only one of these may exist at a time\"));\n    }\n\n    let (s_css_path, css) = if css_file.exists() {\n        let css_file_content = std::fs::read_to_string(&css_file)\n            .with_context(|| format!(\"Given CSS file doesn't exist: {}\", css_file.display()))?;\n        let css = replace_env_var_references(css_file_content);\n        (css_file, css)\n    } else {\n        let scss_file_content =\n            std::fs::read_to_string(&scss_file).with_context(|| format!(\"Given SCSS file doesn't exist! {}\", path.display()))?;\n        let file_content = replace_env_var_references(scss_file_content);\n        let grass_config = grass::Options::default().load_path(path);\n        let css = grass::from_string(file_content, &grass_config).map_err(|err| anyhow!(\"SCSS parsing error: {}\", err))?;\n        (scss_file, css)\n    };\n\n    let mut file_db = error_handling_ctx::FILE_DATABASE.write().unwrap();\n    let file_id = file_db.insert_string(s_css_path.display().to_string(), css.clone())?;","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/elkowar/eww/blob/48f5aa8b379adf29da0b0bb9ca04164f65d8bdaa/crates/eww/src/config/scss.rs#L1-L32","documentation":"parse_scss_from_config loads the widget stylesheet from the config directory. Eww supports exactly one stylesheet — either eww.css or eww.scss — because the two would conflict over which source of truth to compile. Having both is rejected up front.","triggerScenarios":"Calling parse_scss_from_config on a config directory that contains both eww.css and eww.scss files.","commonSituations":"User migrates from CSS to SCSS (or vice versa) and copies the new file in without deleting the old one; a distro package or dotfiles repo ships both files.","solutions":["Delete (or rename outside the config dir) the eww.css file if you intend to use SCSS","Delete eww.scss if you intend to use plain CSS","Keep exactly one stylesheet in the config directory and reload eww"],"exampleFix":"# before: both exist\n~/.config/eww/eww.css  ~/.config/eww/eww.scss   # error\n\n# after\nrm ~/.config/eww/eww.css   # keep eww.scss","handlingStrategy":"validation","validationCode":"# ensure exactly one stylesheet exists\nls ~/.config/eww/eww.css ~/.config/eww/eww.scss 2>/dev/null | wc -l  # must be 0 or 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When migrating css<->scss, delete the old file in the same commit","Add a dotfiles install script that removes the opposite stylesheet","Keep stylesheets out of template snapshots that duplicate files"],"tags":["eww","config","scss","css","conflict"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"48f5aa8b379adf29da0b0bb9ca04164f65d8bdaa","analyzedAt":"2026-09-08T03:13:26.897Z","contentChangedAt":"2026-09-08T03:13:26.897Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}