<commit_before>require "sass"

class SassHandler < Kemal::Handler
  def call(context)
    Dir.glob("./scss/*.scss")
       .reject {|a| File.basename(a).starts_with?('_')}
       .each do |filename|
      css_name = "./public/css/#{File.basename(filename, ".scss")}.css"

      # Do not recompile if there have been no modifications to the original SCSS file since compilation
      next if File.exists?(css_name) && File.stat(filename).mtime < File.stat(css_name).mtime

      css = Sass.compile_file(
        filename,
        source_comments: false,
        input_path: filename,
        output_path: css_name,
        # As of right now, sass.cr doesn't allow me to create separate sourcemap files
        source_map_embed: Kemal.config.env == "development"
      )

      Dir.mkdir("./public/css") unless Dir.exists?("./public/css")
      File.write(css_name, css)<commit_msg>temporarily remove sourcemaps<commit_after>require "sass"

class SassHandler < Kemal::Handler
  def call(context)
    Dir.glob("./scss/*.scss")
       .reject {|a| File.basename(a).starts_with?('_')}
       .each do |filename|
      css_name = "./public/css/#{File.basename(filename, ".scss")}.css"

      # Do not recompile if there have been no modifications to the original SCSS file since compilation
      next if File.exists?(css_name) && File.stat(filename).mtime < File.stat(css_name).mtime

      css = Sass.compile_file(
        filename,
        source_comments: false,
        input_path: filename,
        output_path: css_name,
        # As of right now, sass.cr doesn't allow me to create separate sourcemap files
        # source_map_embed: Kemal.config.env == "development"
      )

      Dir.mkdir("./public/css") unless Dir.exists?("./public/css")
      File.write(css_name, css)
{'fraction_non_alphanumeric': 0.12879640044994375, 'fraction_numerical': 0.0, 'mean_word_length': 2.935840707964602, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '84615', 'n_tokens_mistral': 571, 'n_tokens_neox': 555, 'n_words': 137}