tailwind-to-style 1.1.2 → 1.1.4

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.
Files changed (2) hide show
  1. package/index.js +11 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -5711,10 +5711,20 @@ const breakpoints = {
5711
5711
  };
5712
5712
 
5713
5713
  function tws(classNames, convertToJson) {
5714
+ if (
5715
+ [
5716
+ !classNames,
5717
+ typeof classNames !== "string",
5718
+ classNames.trim() === "",
5719
+ ].includes(true)
5720
+ ) {
5721
+ return convertToJson ? {} : "";
5722
+ }
5723
+
5714
5724
  const cssString = generateTailwindCssString().replace(/\s\s+/g, " ");
5715
5725
  const cssObject = convertCssToObject(cssString);
5716
5726
 
5717
- const classes = classNames.match(/[\w-]+(?:\[[^\]]+\])?|\w+/g);
5727
+ const classes = classNames.match(/[\w-]+\[[^\]]+\]|[\w-]+\.\d+|[\w-]+/g);
5718
5728
 
5719
5729
  let cssResult = classes.map((className) => {
5720
5730
  if (cssObject[className]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-to-style",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Convert tailwind classes to inline style",
5
5
  "main": "index.js",
6
6
  "scripts": {