@tailwindcss/postcss
Advanced tools
Comparing version 0.0.0-development.4 to 0.0.0-development.5
@@ -14,4 +14,24 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/index.ts | ||
function(root, result) { | ||
let hasApply = false; | ||
let hasTailwind = false; | ||
root.walkAtRules((rule) => { | ||
if (rule.name === "apply") { | ||
hasApply = true; | ||
} else if (rule.name === "tailwind") { | ||
hasApply = true; | ||
hasTailwind = true; | ||
return false; | ||
} | ||
}); | ||
if (!hasTailwind && !hasApply) | ||
return; | ||
function replaceCss(css) { | ||
root.removeAll(); | ||
root.append(_postcss2.default.parse(_tailwindcss.optimizeCss.call(void 0, css), result.opts)); | ||
} | ||
if (!hasTailwind) { | ||
replaceCss(_tailwindcss.compile.call(void 0, root.toString(), [])); | ||
return; | ||
} | ||
let { candidates, files, globs } = _oxide.scanDir.call(void 0, { base, globs: true }); | ||
let css = _tailwindcss.optimizeCss.call(void 0, _tailwindcss.compile.call(void 0, root.toString(), candidates)); | ||
for (let file of files) { | ||
@@ -34,5 +54,3 @@ result.messages.push({ | ||
} | ||
let nodes = _postcss2.default.parse(css); | ||
root.removeAll(); | ||
root.append(nodes); | ||
replaceCss(_tailwindcss.compile.call(void 0, root.toString(), candidates)); | ||
} | ||
@@ -39,0 +57,0 @@ ] |
{ | ||
"name": "@tailwindcss/postcss", | ||
"version": "0.0.0-development.4", | ||
"version": "0.0.0-development.5", | ||
"description": "PostCSS plugin for Tailwind CSS, a utility-first CSS framework for rapidly building custom user interfaces", | ||
@@ -20,4 +20,4 @@ "license": "MIT", | ||
"postcss-import": "^16.0.0", | ||
"@tailwindcss/oxide": "^0.0.0-development.4", | ||
"tailwindcss": "^0.0.0-development.4" | ||
"@tailwindcss/oxide": "^0.0.0-development.5", | ||
"tailwindcss": "^0.0.0-development.5" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
3522
66