hugosoucycc

[ARCHIVED] Another old source code of <hugo.soucy.cc>.
Log | Files | Refs | Submodules

commit e1b69905f99e8d49625f6886f82831ad9521470b
parent 68277a16b7888d8afd300b8040ee6ed4af33513a
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Mon, 27 Mar 2017 09:52:43 -0400

Enhance the px to em function

Diffstat:
Mconfig/preprocessor.cfg | 20++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/config/preprocessor.cfg b/config/preprocessor.cfg @@ -20,20 +20,24 @@ export JS_DST_PATH=$DST_PATH/js # Convert pixels to EMs px_to_em () { pixel_size=$1 - pixel_context=$2 - - echo $(bc <<< "scale=4;$pixel_size/$pixel_context")em + pixel_context=16 + + if [ -n "$2" ]; then + pixel_context=$2 + fi + + echo "$(bc <<< "scale=4;$pixel_size/$pixel_context")em" } # Associative array with breakpoints and sizes in EMs declare -A BREAKPOINTS SIZES export BREAKPOINTS=( - [xxs]=$(px_to_em 360 16) - [xs]=$(px_to_em 520 16) - [sm]=$(px_to_em 768 16) - [md]=$(px_to_em 992 16) - [lg]=$(px_to_em 1140 16) + [xxs]=$(px_to_em 360) + [xs]=$(px_to_em 520) + [sm]=$(px_to_em 768) + [md]=$(px_to_em 992) + [lg]=$(px_to_em 1140) ) export SIZES=(