From fff7e7306410c67b015e1a7b5661169ead179ebb Mon Sep 17 00:00:00 2001 From: reverend Date: Wed, 6 Jan 2021 21:03:22 +0100 Subject: [PATCH] Tool for converting stylus vars into css vars --- components/00_Global/_cssParameter.styl | 44 +++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 components/00_Global/_cssParameter.styl diff --git a/components/00_Global/_cssParameter.styl b/components/00_Global/_cssParameter.styl new file mode 100644 index 0000000..ace2c34 --- /dev/null +++ b/components/00_Global/_cssParameter.styl @@ -0,0 +1,44 @@ +_lower_map = { + A: 'a', + B: 'b', + C: 'c', + D: 'd', + E: 'e', + F: 'f', + G: 'g', + H: 'h', + I: 'i', + J: 'j', + K: 'k', + L: 'l', + M: 'm', + N: 'n', + O: 'o', + P: 'p', + Q: 'q', + R: 'r', + S: 's', + T: 't', + U: 'u', + V: 'v', + W: 'w', + X: 'x', + Y: 'y', + Z: 'z' +} + +lower(string) + for upper, lower in _lower_map + string = replace(upper, lower, string) + string + +upper(string) + for upper, lower in _lower_map + string = replace(lower, upper, string) + string + +RV-CSSParameter(block) + for name, value in block + css-var-name = '--%s' % unquote(name) + add-property(css-var-name, value) + define(name, unquote('var(--%s)' % (unquote(name))), true) \ No newline at end of file