Refactor darkmode

This commit is contained in:
cuom1999 2024-07-08 22:29:57 -05:00
parent 5537ef5522
commit d08010a2ab
6 changed files with 7899 additions and 3 deletions

View file

@ -16,8 +16,34 @@ fi
FILES=(sass_processed/style.css sass_processed/content-description.css sass_processed/table.css sass_processed/ranks.css) FILES=(sass_processed/style.css sass_processed/content-description.css sass_processed/table.css sass_processed/ranks.css)
DARKMODE_CSS_FILES=(resources/darkmode.css resources/darkmode-svg.css)
DARKMODE_SCSS_FILES=(resources/darkmode-processed.scss resources/darkmode-svg-processed.scss)
DARKMODE_SASS_PROCESSED_FILES=(sass_processed/darkmode-processed.css sass_processed/darkmode-svg-processed.css)
# Function to convert CSS to SCSS and prepend .darkmode
convert_and_prepend_darkmode() {
local css_file=$1
local scss_file=$2
local temp_file=$(mktemp)
echo ".darkmode {" > $temp_file
cat $css_file >> $temp_file
echo "}" >> $temp_file
mv $temp_file $scss_file
}
for i in "${!DARKMODE_CSS_FILES[@]}"; do
convert_and_prepend_darkmode "${DARKMODE_CSS_FILES[$i]}" "${DARKMODE_SCSS_FILES[$i]}"
done
cd `dirname $0` cd `dirname $0`
sass resources:sass_processed sass resources:sass_processed
echo echo
postcss "${FILES[@]}" --verbose --use autoprefixer -d resources postcss "${FILES[@]}" --verbose --use autoprefixer -d resources
echo
postcss "${DARKMODE_SASS_PROCESSED_FILES[@]}" --verbose --use autoprefixer -d resources

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}"> <html lang="{{ LANGUAGE_CODE }}" {% if use_darkmode %}class="darkmode"{% endif %}>
<head> <head>
<title>{% block title %}{{ title }} - {{ SITE_LONG_NAME }}{% endblock %}</title> <title>{% block title %}{{ title }} - {{ SITE_LONG_NAME }}{% endblock %}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@ -72,8 +72,8 @@
{% endif %} {% endif %}
{% if use_darkmode %} {% if use_darkmode %}
<link rel="stylesheet" href="{{ static('darkmode.css') }}"> <link rel="stylesheet" href="{{ static('darkmode-processed.css') }}">
<link rel="stylesheet" href="{{ static('darkmode-svg.css') }}"> <link rel="stylesheet" href="{{ static('darkmode-svg-processed.css') }}">
{% endif %} {% endif %}
<noscript> <noscript>