<commit_before>var _ = Npm.require('lodash');
var Future = Npm.require('fibers/future');
var sass = Npm.require('node-sass');

Plugin.registerSourceHandlers = function(extensions, options, handler) {
	_.each(extensions, function(extension) {
		Plugin.registerSourceHandler(extension, options, handler);
	});
};

Plugin.registerSourceHandlers(['sass', 'scss'], {archMatching: 'web'}, function(compileStep) {
	
});<commit_msg>Source maps<commit_after>var _ = Npm.require('lodash');
var Future = Npm.require('fibers/future');
var sass = Npm.require('node-sass');

Plugin.registerSourceHandlers = function(extensions, options, handler) {
	_.each(extensions, function(extension) {
		Plugin.registerSourceHandler(extension, options, handler);
	});
};

Plugin.registerSourceHandlers(['sass', 'scss'], {archMatching: 'web'}, function(compileStep) {
	var source = compileStep.read().toString('utf8');
	console.log("Compiling file:", compileStep.inputPath);
	var future = new Future();

	try {
		sass.render({
			file: compileStep.fullInputPath,
			sourceMap: true,
			omitSourceMapUrl: true,
			outFile: "file.css",
			success: function(result) {
				future.return(result);
			},
			error: function() {
				future.throw("wot error");
			}
		});

		var result = future.wait();
		console.log("Result:", result);

		if (result.map) {
			var sourceMap = JSON.parse(result.map);
			delete sourceMap.file;
			sourceMap.sources = [compileStep.inputPath];
			sourceMap.sourcesContent = [source];
			console.log("Source map:", sourceMap);
		}
	} catch (e) {
		console.log(e);
	}
});
{'fraction_non_alphanumeric': 0.16687979539641945, 'fraction_numerical': 0.0006393861892583121, 'mean_word_length': 5.161417322834645, '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': '1269536', 'n_tokens_mistral': 550, 'n_tokens_neox': 499, 'n_words': 94}