UNPKG

2 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", {
3 value: true
4});
5const _setupTrackingContext = /*#__PURE__*/ _interopRequireDefault(require("./lib/setupTrackingContext"));
6const _processTailwindFeatures = /*#__PURE__*/ _interopRequireDefault(require("./processTailwindFeatures"));
7const _sharedState = require("./lib/sharedState");
8const _findAtConfigPath = require("./lib/findAtConfigPath");
9function _interopRequireDefault(obj) {
10 return obj && obj.__esModule ? obj : {
11 default: obj
12 };
13}
14module.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 function(root, result) {
24 var ref;
25 // Use the path for the `@config` directive if it exists, otherwise use the
26 // path for the file being processed
27 configOrPath = (ref = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : 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 root1 of roots){
32 if (root1.type === "root") {
33 (0, _processTailwindFeatures.default)(context)(root1, result);
34 }
35 }
36 return;
37 }
38 (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};
48module.exports.postcss = true;