@crocsx/scss-to-json
Version:
A utility for converting SCSS variables files to JSON
29 lines (21 loc) • 610 B
JavaScript
;
var Utilities = {
stripNewLinesAndSemicolons: function(scssString) {
return scssString.replace(/\n/g, '').replace(/\;/g, '');
},
stripSpaces: function(scssString) {
return scssString.replace(/\s/g, '');
},
removeFlags: function(value) {
return value.replace(/\!\w+/g, '');
},
removeInlineComments: function(value) {
var transformedValue = value;
var commentIndex = value.indexOf('//');
if (commentIndex > -1) {
transformedValue = transformedValue.substring(0, commentIndex);
}
return transformedValue;
}
};
module.exports = Utilities;