| 1 | "use strict";
|
|---|
| 2 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 3 | value: true
|
|---|
| 4 | });
|
|---|
| 5 | const _setupTrackingContext = /*#__PURE__*/ _interop_require_default(require("./lib/setupTrackingContext"));
|
|---|
| 6 | const _processTailwindFeatures = /*#__PURE__*/ _interop_require_default(require("./processTailwindFeatures"));
|
|---|
| 7 | const _sharedState = require("./lib/sharedState");
|
|---|
| 8 | const _findAtConfigPath = require("./lib/findAtConfigPath");
|
|---|
| 9 | function _interop_require_default(obj) {
|
|---|
| 10 | return obj && obj.__esModule ? obj : {
|
|---|
| 11 | default: obj
|
|---|
| 12 | };
|
|---|
| 13 | }
|
|---|
| 14 | module.exports = function tailwindcss(configOrPath) {
|
|---|
| 15 | return {
|
|---|
| 16 | postcssPlugin: "tailwindcss",
|
|---|
| 17 | plugins: [
|
|---|
| 18 | _sharedState.env.DEBUG && function(root) {
|
|---|
| 19 | console.log("\n");
|
|---|
| 20 | console.time("JIT TOTAL");
|
|---|
| 21 | return root;
|
|---|
| 22 | },
|
|---|
| 23 | async function(root, result) {
|
|---|
| 24 | var _findAtConfigPath1;
|
|---|
| 25 | // Use the path for the `@config` directive if it exists, otherwise use the
|
|---|
| 26 | // path for the file being processed
|
|---|
| 27 | configOrPath = (_findAtConfigPath1 = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && _findAtConfigPath1 !== void 0 ? _findAtConfigPath1 : configOrPath;
|
|---|
| 28 | let context = (0, _setupTrackingContext.default)(configOrPath);
|
|---|
| 29 | if (root.type === "document") {
|
|---|
| 30 | let roots = root.nodes.filter((node)=>node.type === "root");
|
|---|
| 31 | for (const root of roots){
|
|---|
| 32 | if (root.type === "root") {
|
|---|
| 33 | await (0, _processTailwindFeatures.default)(context)(root, result);
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|
| 36 | return;
|
|---|
| 37 | }
|
|---|
| 38 | await (0, _processTailwindFeatures.default)(context)(root, result);
|
|---|
| 39 | },
|
|---|
| 40 | _sharedState.env.DEBUG && function(root) {
|
|---|
| 41 | console.timeEnd("JIT TOTAL");
|
|---|
| 42 | console.log("\n");
|
|---|
| 43 | return root;
|
|---|
| 44 | }
|
|---|
| 45 | ].filter(Boolean)
|
|---|
| 46 | };
|
|---|
| 47 | };
|
|---|
| 48 | module.exports.postcss = true;
|
|---|