<commit_before>#!/bin/bash
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#                         Copyright (C) 2014 <NAME>                         #
#                             All Rights Reserved                             #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script to build static files for the site.

set -x

ROOT_DIR=$(realpath "$(dirname $0)/..")
SCSS_DIR="$ROOT_DIR/scss"
STATIC_DIR="$ROOT_DIR/static"

# Build SCSS files in the SCSS dir to CSS files in the static dir.
function BuildScssFiles() {
  scss \
      --update \
      "$SCSS_DIR:$STATIC_DIR"
}


# Build Dart files in the static dir.
function BuildDartFiles() {
  find \
      "$STATIC_DIR" \
      -name '*.dart' \
      -exec \
      dart2js \
      '{}' \
      -o '{}.js' \
      ';'
}

BuildScssFiles
BuildDartFiles<commit_msg>Improve static file build script<commit_after>#!/bin/bash
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#                         Copyright (C) 2014 <NAME>                         #
#                             All Rights Reserved                             #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script to build static files for the site.

# Directory paths.
ROOT_DIR=$(realpath "$(dirname $0)/..")
SCSS_DIR="$ROOT_DIR/scss"
STATIC_DIR="$ROOT_DIR/static"


# Build SCSS files in the SCSS dir to CSS files in the static dir.
function BuildScssFiles() {
  ( set -x; scss \
      --update \
      "$SCSS_DIR:$STATIC_DIR" )
}


# Build Dart files in the static dir.
function BuildDartFiles() {
  (set -x; find \
      "$STATIC_DIR" \
      -name '*.dart' \
      -exec \
      dart2js \
      '{}' \
      -o '{}.js' \
      ';' )
}


TIMEFORMAT=$'\033[32m[ %Us ]\033[m'
time BuildScssFiles
time BuildDartFiles
{'fraction_non_alphanumeric': 0.19306666666666666, 'fraction_numerical': 0.010666666666666666, 'mean_word_length': 1.5454545454545454, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '772830', 'n_tokens_mistral': 699, 'n_tokens_neox': 661, 'n_words': 134}