Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions lib/renderer/stss2scss.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ var reNewline = /\n|\r\n|\r|\f/,

/**
* Include all @imported STSS files.
*
*
* Replaces all `@import <file.stss> [, <file1.stss>]` statements by the content of those files.
*
*
* @param {String} stss STSS structured markup
* @param {Object} options Dictionary containing additional instructions
* @param {String} [options.file] Filename of the STSS file currently being parsed
Expand Down Expand Up @@ -64,14 +64,14 @@ function includeImports(stss, options) {
if (!file) {
throw parseError('STSS file to import not found or unreadable: "' + filename + '"', match, stss, options);
}

content = includeImports(fs.readFileSync(file, 'utf-8'), {
includePaths: importPaths,
file: filename
file: options.file ? path.join(path.dirname(options.file), filename) : filename
});

imported += content + "\n";

return content;
});
return imported;
Expand Down Expand Up @@ -100,7 +100,7 @@ module.exports = function (stss, options) {
} catch (err) {
return err;
}

// Replace hyphenated terms with camelCased variants
scss = stss.replace(reDeclCSS, function(match, key, value) {
if (key.search(/-/) !== -1) {
Expand Down Expand Up @@ -152,7 +152,7 @@ module.exports = function (stss, options) {
for (i = 0; i < ln; i++) {
value = values[i].trim();
isObject = /^\{[\s\S]+\}$/.test(value);

if (isObject) {
tempName = 'stss-array' + arrayIdx + '-obj' + i;
arrayDecl.push('-' + tempName + value);
Expand All @@ -179,7 +179,7 @@ module.exports = function (stss, options) {

/**
* Parse the error string into a new Error object.
*
*
* @param {String} msg Error message (as generated by node-sass)
* @param {String} stss SCSS source (that potentially contains the error if it is source-based)
* @param {Object} options Dictionary containing additional instructions
Expand Down Expand Up @@ -214,7 +214,7 @@ function parseError(msg, statement, stss, options) {

/**
* Get the line and line number that contains the provided statement.
*
*
* @param {String} text Source text
* @param {String} statement The statment
* @return {Object} Line information
Expand All @@ -225,7 +225,7 @@ function getLineInfo(text, statement) {
lines = text.split(/\r\n|\n|\r|\f/),
ln = lines.length,
i = -1;

while (!info && ++i < ln) {
if (reStmnt.test(lines[i])) {
info = {
Expand All @@ -236,4 +236,4 @@ function getLineInfo(text, statement) {
}

return info;
}
}