elkowar/eww · error

Encountered both an SCSS and CSS file. Only one of these…

Error message

Encountered both an SCSS and CSS file. Only one of these may exist at a time

What it means

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.

Solutions

  1. Delete (or rename outside the config dir) the eww.css file if you intend to use SCSS
  2. Delete eww.scss if you intend to use plain CSS
  3. Keep exactly one stylesheet in the config directory and reload eww

Example fix

# before: both exist
~/.config/eww/eww.css  ~/.config/eww/eww.scss   # error

# after
rm ~/.config/eww/eww.css   # keep eww.scss
Defensive patterns

Strategy: validation

Validate before calling

# ensure exactly one stylesheet exists
ls ~/.config/eww/eww.css ~/.config/eww/eww.scss 2>/dev/null | wc -l  # must be 0 or 1

Prevention

When it happens

Trigger: Calling parse_scss_from_config on a config directory that contains both eww.css and eww.scss files.

Common situations: 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.

Related errors


AI-assisted analysis of elkowar/eww@48f5aa8b37 (2026-09-08). Data as JSON: /api/errors/5cb0eb5c9657656a. Report an issue: GitHub.

Appendix: source

Thrown at crates/eww/src/config/scss.rs:14

use std::path::Path;

use anyhow::{anyhow, Context};

use crate::{error_handling_ctx, util::replace_env_var_references};

/// read an (s)css file, replace all environment variable references within it and
/// then parse it into css.
/// Also adds the CSS to the [`crate::file_database::FileDatabase`]
pub fn parse_scss_from_config(path: &Path) -> anyhow::Result<(usize, String)> {
    let css_file = path.join("eww.css");
    let scss_file = path.join("eww.scss");
    if css_file.exists() && scss_file.exists() {
        return Err(anyhow!("Encountered both an SCSS and CSS file. Only one of these may exist at a time"));
    }

    let (s_css_path, css) = if css_file.exists() {
        let css_file_content = std::fs::read_to_string(&css_file)
            .with_context(|| format!("Given CSS file doesn't exist: {}", css_file.display()))?;
        let css = replace_env_var_references(css_file_content);
        (css_file, css)
    } else {
        let scss_file_content =
            std::fs::read_to_string(&scss_file).with_context(|| format!("Given SCSS file doesn't exist! {}", path.display()))?;
        let file_content = replace_env_var_references(scss_file_content);
        let grass_config = grass::Options::default().load_path(path);
        let css = grass::from_string(file_content, &grass_config).map_err(|err| anyhow!("SCSS parsing error: {}", err))?;
        (scss_file, css)
    };

    let mut file_db = error_handling_ctx::FILE_DATABASE.write().unwrap();
    let file_id = file_db.insert_string(s_css_path.display().to_string(), css.clone())?;

View on GitHub (pinned to 48f5aa8b37)