ucladevx / Bmaps-Frontend

Frontend for Bmaps with UCLA DevX.
https://www.bmaps.io
8 stars 1 forks source link

Consistent CSS (move all sizing to rem) #337

Open Kimeiga opened 4 years ago

Kimeiga commented 4 years ago

this is a big Maybe. But consistent css especially on the desktop calendar view yes

wfehrnstrom commented 4 years ago

Useful precommit hook script to ensure that all references to px are known and eventually phased out:

#!/bin/bash

WORK_DIR=$1
SRCH_PATH=$WORK_DIR/src
CMD=$(grep --include=\*.{sc,c}ss --line-buffered -Ern -e 'px' $SRCH_PATH)
if [[ $CMD != '' ]]; then
    echo "-- WARNING: non-relative px units found in the following css files. we are trying to make all css rem based. --" 
    echo "$CMD"
    read -r -p "Are you sure you still want to commit this code? (y/n): " response
    case "$response" in
        [yY][eE][sS]|[yY])
            exit 0
            ;;
        *)
            exit 1
            ;;
    esac    
fi 
exit 1
Kimeiga commented 4 years ago

This is awesome! How do we integrate it into the build process?

wfehrnstrom commented 4 years ago

It's a git-hook so normally it has to be run within the hooks folder of .git. We should decide whether we want to keep this normal structure or whether we want to version our hooks so we track their changes. This can be done by changing git config to point its hook directory variable at another location that is versioned, somewhere outside the .git folder. I've added a commit to the consistent css branch that does exactly this, because I think versioning the hooks themselves is a good idea but it definitely has drawbacks too: more state to keep track of. In order to switch to the new git-hooks location once you've pulled in my changes, run "make init" and that will change your hooks config variable. If everyone does this when they pull in my changes than the new git hook will automatically run for everyone pre-commit stage