Skip to content

Commit

Permalink
fix: handle cases when properties undefined in replaceSymbols (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored May 29, 2019
1 parent 98d6b26 commit 710954e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ cache:

matrix:
include:
- node_js: "11"
- node_js: "12"
env: JOB_PART=pretest
- node_js: "6"
env: JOB_PART=test
- node_js: "8"
env: JOB_PART=test
- node_js: "10"
env: JOB_PART=test
- node_js: "11"
- node_js: "12"
env: JOB_PART=test

before_script:
Expand Down
5 changes: 3 additions & 2 deletions src/replaceSymbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import replaceValueSymbols from "./replaceValueSymbols.js";

const replaceSymbols = (css, replacements) => {
css.walk(node => {
if (node.type === "decl") {
if (node.type === "decl" && node.value) {
node.value = replaceValueSymbols(node.value, replacements);
} else if (node.type === "rule") {
} else if (node.type === "rule" && node.selector) {
node.selector = replaceValueSymbols(node.selector, replacements);
} else if (
node.type === "atrule" &&
node.params &&
["media", "supports"].includes(node.name.toLowerCase())
) {
node.params = replaceValueSymbols(node.params, replacements);
Expand Down

0 comments on commit 710954e

Please sign in to comment.