Skip to content

Commit

Permalink
escape
Browse files Browse the repository at this point in the history
  • Loading branch information
malash committed May 28, 2024
1 parent 80d90e1 commit 4530132
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/cli/src/config/postcssLinariaPreprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ const postcssLinariaPreprocessor: PluginCreator<Options> = () => ({
}
}
},
Declaration(decl) {
// escape breaking control characters
// from: https://github.com/thysultan/stylis/blob/v3.5.4/tests/spec.js#L113C3-L116
if (decl.value.match(/[\0\r\f]/)) {
decl.value = decl.value.replace(/\0/g, '\\0').replace(/\r/g, '\\r').replace(/\f/g, '\\f');
}
},
});

postcssLinariaPreprocessor.postcss = true;
Expand Down

0 comments on commit 4530132

Please sign in to comment.