<commit_before>var util = require('util');
var utils = require('loader-utils');
var sass = require('node-sass');
var path = require('path');
var sassGraph = require('sass-graph');


module.exports = function (content) {
    this.cacheable();
    var callback = this.async();

    var opt = utils.parseQuery(this.query);
    opt.data = content;

    // set include path to fix imports
    opt.includePaths = opt.includePaths || [];
    opt.includePaths.push(path.dirname(this.resourcePath));
    if (this.options.resolve && this.options.resolve.root) {
        var root = [].concat(this.options.resolve.root);
        opt.includePaths = opt.includePaths.concat(root);
    }

    // output compressed by default
    opt.outputStyle = opt.outputStyle || 'compressed';
    opt.stats = {};

    // mark dependencies
    var graph = sassGraph.parseFile(this.resourcePath, {loadPaths: opt.includePaths});
    graph.visitDescendents(this.resourcePath, function (imp) {
        this.addDependency(imp);
    }.bind(this));

    opt.success = function (css) {
        callback(null, css);
    }.bind(this);
<commit_msg>fix #21<commit_after>var util = require('util');
var utils = require('loader-utils');
var sass = require('node-sass');
var path = require('path');
var sassGraph = require('sass-graph');


module.exports = function (content) {
    this.cacheable();
    var callback = this.async();

    var opt = utils.parseQuery(this.query);
    opt.data = content;

    // skip empty files, otherwise it will stop webpack, see issue #21
    if(opt.data.trim() == '') {
        return callback(null, content);
    }

    // set include path to fix imports
    opt.includePaths = opt.includePaths || [];
    opt.includePaths.push(path.dirname(this.resourcePath));
    if (this.options.resolve && this.options.resolve.root) {
        var root = [].concat(this.options.resolve.root);
        opt.includePaths = opt.includePaths.concat(root);
    }

    // output compressed by default
    opt.outputStyle = opt.outputStyle || 'compressed';
    opt.stats = {};

    // mark dependencies
    var graph = sassGraph.parseFile(this.resourcePath, {loadPaths: opt.includePaths});
    graph.visitDescendents(this.resourcePath, function (imp) {
        this.addDependency(imp);
    }.bind(this));

    opt.success = function (css) {
        callback(null, css);
    }.bind(this);

{'fraction_non_alphanumeric': 0.14915254237288136, 'fraction_numerical': 0.001694915254237288, 'mean_word_length': 3.238779174147217, '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': '7399557', 'n_tokens_mistral': 717, 'n_tokens_neox': 699, 'n_words': 156}