Skip to content
This repository was archived by the owner on May 28, 2021. It is now read-only.

Support multi-line variable declaration. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ var stripComments = require('strip-json-comments');
var getVariables = function(content) {
const variableRegex = /\$(.+):\s+(.+);/;
const variables = {};
let lines = "";

stripComments(content).split('\n').forEach(line => {
const variable = variableRegex.exec(line);
lines += line.trim();
const variable = variableRegex.exec(lines);
if (!variable) { return; }
lines = "";

const name = camelCase(variable[1].trim());
const value = variable[2].replace(/!default|!important/g, '').trim();
Expand Down