<commit_before>var fs = require('fs');
var path = require('path');
var sass = require('node-sass');

module.exports = function(grunt) {
  function writeFile(path, contents) {
    if(grunt.file.exists(path)) {
      grunt.file.delete(path);
    }

    grunt.file.write(path, contents);
  }

  grunt.registerTask('sass', function() {
    grunt.log.writeln(sass.info());

    var inFile = path.resolve('scss/app.scss');
    var outFile = path.resolve('dist/app.min.css');

    var result = sass.renderSync({
      file: inFile,
      outFile: outFile,
      outputStyle: 'compressed',
      sourceMap: false
    });

    writeFile(outFile, result.css);
  });
};<commit_msg>Add proper success/error logging to Sass task.<commit_after>var fs = require('fs');
var path = require('path');
var sass = require('node-sass');

module.exports = function(grunt) {
  grunt.registerTask('sass', function() {
    var done = this.async();
    grunt.log.writeln(sass.info());

    var inFile = path.resolve('scss/app.scss');
    var outFile = path.resolve('dist/app.min.css');

    sass.render({
      file: inFile,
      outFile: outFile,
      outputStyle: 'compressed',
      sourceMap: false,
      success: function(result) {
        if(grunt.file.exists(outFile)) {
          grunt.file.delete(outFile);
        }

        grunt.file.write(outFile, result.css);
        grunt.log.ok('Wrote "' + outFile + '".')

        done();
      },
      error: function(error) {
        grunt.log.error('Error: ' + error.message);
        grunt.log.error('File: ' + error.file);
        grunt.log.error('Line: ' + error.line);
        done();
      }
    });

  });
};
{'fraction_non_alphanumeric': 0.17142857142857143, 'fraction_numerical': 0.0, 'mean_word_length': 2.7409090909090907, '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': '7657167', 'n_tokens_mistral': 563, 'n_tokens_neox': 552, 'n_words': 96}