postcss-elm-tailwind
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -57,2 +57,4 @@ function elmHeader(elm_fns) { | ||
cls = cls.replace(/\::(placeholder)$/, ""); | ||
// | ||
cls = cls.replace(/\\\//g, "/"); | ||
// make \/ safe for elm | ||
@@ -70,12 +72,12 @@ cls = cls.replace(/\\([/])/g, "\\\\$1"); | ||
function toElmName(cls, prefix) { | ||
if (!prefix) { | ||
prefix = ""; | ||
} | ||
re_neg_with_prefix = new RegExp(`(${prefix})-([p|m])`); | ||
var elm = cls; | ||
// handle negative with prefix | ||
elm = elm.replace(re_neg_with_prefix, "$1neg_$2"); | ||
if (prefix) { | ||
re_neg_with_prefix = new RegExp(`(${prefix})-([p|m])`); | ||
elm = elm.replace(re_neg_with_prefix, "$1neg_$2"); | ||
} | ||
// handle negative at start of string | ||
elm = elm.replace(/^-([p|m])/, "_neg_$1"); | ||
// handle negative with variant | ||
elm = elm.replace(/:-([p|m])/, "_neg_$1"); | ||
// replace dashes now we have sorted the negative stuff | ||
@@ -86,3 +88,3 @@ elm = elm.replace(/-/g, "_"); | ||
// handle fractions | ||
elm = elm.replace(/\\\\\//g, "over"); | ||
elm = elm.replace(/\//g, "over"); | ||
// clean up | ||
@@ -89,0 +91,0 @@ elm = elm.replace(/\\__/g, "_"); |
{ | ||
"name": "postcss-elm-tailwind", | ||
"main": "./index.js", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "PostCSS plugin Tailwind classes for Elm", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -22,6 +22,9 @@ const h = require("../helpers"); | ||
assert.equal( | ||
h.fixClass("hover:tw-bg-blue-500:hover"), | ||
h.fixClass(".hover:tw-bg-blue-500:hover"), | ||
"hover:tw-bg-blue-500" | ||
); | ||
}); | ||
it("ratio", function() { | ||
assert.equal(h.fixClass(".w-1\\/2"), "w-1/2"); | ||
}); | ||
}); | ||
@@ -69,2 +72,11 @@ | ||
}); | ||
it("cursor-pointer", function() { | ||
assert.equal( | ||
h.toElmName(h.fixClass(".cursor-pointer"), ""), | ||
"cursor_pointer" | ||
); | ||
}); | ||
it("font-medium", function() { | ||
assert.equal(h.toElmName(h.fixClass(".font-medium"), ""), "font_medium"); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11762
228