NDOJ/make_style.sh

50 lines
1.3 KiB
Bash
Raw Normal View History

2020-01-21 06:35:58 +00:00
#!/bin/bash
if ! [ -x "$(command -v sass)" ]; then
echo 'Error: sass is not installed.' >&2
exit 1
fi
if ! [ -x "$(command -v postcss)" ]; then
echo 'Error: postcss is not installed.' >&2
exit 1
fi
if ! [ -x "$(command -v autoprefixer)" ]; then
echo 'Error: autoprefixer is not installed.' >&2
exit 1
fi
FILES=(sass_processed/style.css sass_processed/content-description.css sass_processed/table.css sass_processed/ranks.css)
2024-07-09 03:29:57 +00:00
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
2020-01-21 06:35:58 +00:00
cd `dirname $0`
2020-03-16 07:56:55 +00:00
sass resources:sass_processed
2020-01-21 06:35:58 +00:00
echo
postcss "${FILES[@]}" --verbose --use autoprefixer -d resources
2024-07-09 03:29:57 +00:00
echo
postcss "${DARKMODE_SASS_PROCESSED_FILES[@]}" --verbose --use autoprefixer -d resources