<commit_before>/*jslint indent: 2, nomen: true, node: true*/
"use strict";

var fs = require("fs"),
  sass = require("node-sass"),
  json2sass = require("json2sass"),
  templateName,
  cssString;

function parseStyle(data, callback) {
  sass.render({
    data: data,
    success: function (css) {
      callback(null, css);
    },
    error: function (err) {
      callback(err);
    }
  });
}

exports.init = function (template, dimensions, callback) {
  var dimensionsScss,
    stock,
    margin;

  templateName = template;
  stock = dimensions.stock;
  margin = dimensions.margin;

  // convert dimensions vars to scss
  // they will be injected into style.scss
  dimensionsScss = json2sass.writeScss(dimensions);

  function parsedStyle(err, css) {
    if (err) {
      callback(err);
      return;
    }

    cssString = css;

    callback();
  }

  function gotStyle(err, scss) {
    if (err) {
      callback(err);
      return;
    }

    scss = dimensionsScss + "\n\n" + scss;

    parseStyle(scss, parsedStyle);
  }

  fs.readFile(__dirname + "/template/" + templateName + "/style.scss", gotStyle);
};

exports.getBlankPage = function (opts) {
  var htmlMarkup;

  if (!templateName) {
    throw new Error("template hasn't been initialised");
  }
<commit_msg>added reading of custom scss<commit_after>/*jslint indent: 2, nomen: true, node: true*/
"use strict";

var fs = require("fs"),
  sass = require("node-sass"),
  json2sass = require("json2sass"),
  templateName,
  cssString;

function parseStyle(data, callback) {
  sass.render({
    data: data,
    success: function (css) {
      callback(null, css);
    },
    error: function (err) {
      callback(err);
    }
  });
}

exports.init = function (template, dimensions, callback) {
  var dimensionsScss,
    stock,
    margin,
    fullScss;

  templateName = template;
  stock = dimensions.stock;
  margin = dimensions.margin;

  // convert dimensions vars to scss
  // they will be injected into style.scss
  dimensionsScss = json2sass.writeScss(dimensions);

  function parsedStyle(err, css) {
    if (err) {
      callback(err);
      return;
    }

    cssString = css;

    callback();
  }

  function gotCustomStyle(err, customStyleScss) {
    if (customStyleScss) {
      fullScss += "\n\n" + customStyleScss;
    }

    parseStyle(fullScss, parsedStyle);
  }

  function gotDefaultStyle(err, scss) {
    if (err) {
      callback(err);
      return;
    }

    fullScss = dimensionsScss + "\n\n" + scss;

    fs.readFile(process.cwd() + "/style.scss", gotCustomStyle);
  }

  fs.readFile(__dirname + "/template/" + templateName + "/style.scss", gotDefaultStyle);
};

exports.getBlankPage = function (opts) {
  var htmlMarkup;

  if (!templateName) {
    throw new Error("template hasn't been initialised");
  }

{'fraction_non_alphanumeric': 0.13522238163558106, 'fraction_numerical': 0.0028694404591104736, 'mean_word_length': 3.0303468208092488, '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': '559346', 'n_tokens_mistral': 947, 'n_tokens_neox': 920, 'n_words': 220}