tailwind-to-style 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +13 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -5714,22 +5714,27 @@ function tws(classNames, convertToJson) {
|
|
|
5714
5714
|
const cssString = generateTailwindCssString().replace(/\s\s+/g, " ");
|
|
5715
5715
|
const cssObject = convertCssToObject(cssString);
|
|
5716
5716
|
|
|
5717
|
-
const classes = classNames.
|
|
5717
|
+
const classes = classNames.match(/[\w-]+(?:\[[^\]]+\])?|\w+/g);
|
|
5718
|
+
|
|
5718
5719
|
let cssResult = classes.map((className) => {
|
|
5719
5720
|
if (cssObject[className]) {
|
|
5720
5721
|
return cssObject[className];
|
|
5721
5722
|
} else if (className.includes("[")) {
|
|
5722
|
-
const
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5723
|
+
const match = className.match(/\[([^\]]+)\]/);
|
|
5724
|
+
if (match) {
|
|
5725
|
+
const customValue = match[1];
|
|
5726
|
+
const baseKey = className.split("[")[0];
|
|
5727
|
+
if (cssObject[`${baseKey}custom`]) {
|
|
5728
|
+
return cssObject[`${baseKey}custom`].replace(
|
|
5729
|
+
/custom_value/g,
|
|
5730
|
+
customValue
|
|
5731
|
+
);
|
|
5732
|
+
}
|
|
5729
5733
|
}
|
|
5730
5734
|
}
|
|
5731
5735
|
return "";
|
|
5732
5736
|
});
|
|
5737
|
+
|
|
5733
5738
|
cssResult = replaceAndRemoveCSSVariables(cssResult.join(""));
|
|
5734
5739
|
cssResult = inlineStyleToJson(cssResult);
|
|
5735
5740
|
|