<commit_before>var through = require('through2');
var gutil = require('gulp-util');
var ext = gutil.replaceExtension;

module.exports = function() {
	var scssToLess = function(file, enc, cb) {

		file.contents = new Buffer(
			file.contents.toString()
				.replace(/\/s[ca]ss\//g, '/less/')
				.replace(/\.scss/g, '.less')
				.replace(/@mixin /g, '.')
				.replace(/@include /g, '.')
				.replace(/\$(\w+)/g, "@$1")
				.replace(/@extend ([\w\-\.]+);/g, "&:extend( $1 );")
				.replace(/ !default/g, '')
				.replace(/',/g, ',')
				.replace(/'\./g, '.')
				.replace(/\'/g, '"')
		        // .replace(/#{([^}]+)}/g, "~\"$1\"")
				.replace(/#{([^}]+)}/g, "$1")
				.replace(/~\"@(\w+)\"/g, "@{$1}")
				.replace(/adjust-hue\(/g, 'spin(')
                .replace(/^.*@import.*$/mg, "")
                .replace(/.*alpha\(.*\r?\n/g, "")

				.replace(
				/(@if)([^{]+)({)/g, function(match, m1, m2, m3) {
					var result = '& when (';
					result += m2.replace(/==/g, '=');
					result += ')' + m3;
					return result;
				})
            );

		file.path = ext(file.path, '.scss');
		this.push(file);
		cb();
	};
	return through.obj(scssToLess);
};
<commit_msg>minor bug fix for scss to less<commit_after>var through = require('through2');
var gutil = require('gulp-util');
var ext = gutil.replaceExtension;

module.exports = function() {
	var scssToLess = function(file, enc, cb) {

		file.contents = new Buffer(
			file.contents.toString()
				.replace(/\/s[ca]ss\//g, '/less/')
				.replace(/\.scss/g, '.less')
				.replace(/@mixin /g, '.')
				.replace(/@include /g, '.')
				.replace(/\$(\w+)/g, "@$1")
				.replace(/@extend ([\w\-\.]+);/g, "&:extend( $1 );")
				.replace(/ !default/g, '')
				.replace(/',/g, ',')
				.replace(/'\./g, '.')
				.replace(/\'/g, '"')
		        // .replace(/#{([^}]+)}/g, "~\"$1\"")
				.replace(/#{([^}]+)}/g, "$1")
				.replace(/~\"@(\w+)\"/g, "@{$1}")
				.replace(/adjust-hue\(/g, 'spin(')
                .replace(/^.*@import.*$/mg, "")
                .replace(/.*alpha\(.*\r?\n/g, "")

                .replace(/calc\((.*?)\);/g, "~\"calc($1)\";")

				.replace(
				/(@if)([^{]+)({)/g, function(match, m1, m2, m3) {
					var result = '& when (';
					result += m2.replace(/==/g, '=');
					result += ')' + m3;
					return result;
				})
            );

		file.path = ext(file.path, '.scss');
		this.push(file);
		cb();
	};
	return through.obj(scssToLess);
};

{'fraction_non_alphanumeric': 0.3113050706566916, 'fraction_numerical': 0.009559434746467166, 'mean_word_length': 2.1754617414248023, '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': '5794345', 'n_tokens_mistral': 1121, 'n_tokens_neox': 960, 'n_words': 150}