Skip to content

Commit

Permalink
unquote string rule working
Browse files Browse the repository at this point in the history
  • Loading branch information
rambleraptor committed May 31, 2019
1 parent 16dae29 commit d8ccd2a
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,18 @@ function rule(primary, _, context) {
}

// Verify we're only looking at quote() calls.
if (node.value !== "quote") {
if (node.value !== "unquote") {
return;
}

// Report error if first character is a quote.
// postcss-value-parser represents quoted strings as type 'string' (as opposed to word)
if (node.nodes[0].quote || vars[node.nodes[0].value] === "string") {
if (
(!node.nodes[0].quote && node.nodes[0].value[0] !== "$") ||
vars[node.nodes[0].value] === "word"
) {
if (context.fix) {
const contents = /quote\((.*)\)/.exec(decl.value);
const contents = /unquote\((.*)\)/.exec(decl.value);

decl.value = contents[1];
} else {
Expand Down

0 comments on commit d8ccd2a

Please sign in to comment.