{
  pkgs,
  lib,
  commonScript,
  ...
}: let
in
  pkgs.writeShellScriptBin "build-stylesheets" ''
    source ${commonScript}

    echo_section "Building stylesheets"
    echo_hint "The command is executed in the current working directory and not in a nix derivation."
    cd_working_dir

    sourcePath="$(pwd)/source"

    function build() {
        source ${commonScript}
        local prefix="''${sourcePath}/"
        echo_step "build stylesheet ''${1#$prefix}"
        ${pkgs.nodejs_21}/bin/node ./development/scripts/buildStylesheets.mjs "$1"
    }

    export -f build

    if ! ${pkgs.fd}/bin/fd --absolute-path --full-path "$sourcePath" --type file --extension pcss -0 | xargs -0 -I {} bash -c 'build "$@"' _ {}; then
      echo_fail "Stylesheet build failed. Exiting."
      exit 1
    fi

    echo_step "Formatting JS code"
    if ! ${pkgs.biome}/bin/biome format --write ./source/
    then
      echo_fail "biome format failed"
      exit 1
    else
        echo_ok "JS code formatted"
    fi

    echo_ok "Stylesheet build successful"
  ''