<commit_before>"use strict";

var path  = require('path');
var fs    = require('fs');

function handleCSS(filename, url, registry) {
  var asset = {filename: filename, result: url};

  var basedir = path.dirname(filename);

  asset.src = fs.readFileSync(filename, 'utf8').replace(
    /([^a-zA-Z0-9])url\(([^\)]+)\)/g, function(_m, prefix, ref) {
      var result = registry.requireAssets(ref, basedir);
      return prefix + 'url(' + result + ')';
    });

  return asset;
}

module.exports = handleCSS;<commit_msg>More orbust CSS handler<commit_after>"use strict";

var path  = require('path');
var fs    = require('fs');

function handleCSS(filename, url, registry) {
  var asset = {filename: filename, result: url};

  var basedir = path.dirname(filename);

  asset.src = fs.readFileSync(filename, 'utf8').replace(
    /([^a-zA-Z0-9])url\(([^\)]+)\)/g, function(_m, prefix, ref) {
      ref = ref
        .replace(/^'/, '').replace(/'$/, '')
        .replace(/^"/, '').replace(/"$/, '');

      var suffix = '';
      ref = ref.replace(/[\?#].+$/, function(m) {
        suffix = m;
        return '';
      });

      var result = registry.requireAssets(ref, basedir);
      return prefix + 'url(' + result + suffix + ')';
    });

  return asset;
}

module.exports = handleCSS;
{'fraction_non_alphanumeric': 0.20748829953198128, 'fraction_numerical': 0.0046801872074883, 'mean_word_length': 3.047318611987382, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3548803', 'n_tokens_mistral': 435, 'n_tokens_neox': 420, 'n_words': 97}