You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.6 KiB

2 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. const _setupTrackingContext = /*#__PURE__*/ _interopRequireDefault(require("./lib/setupTrackingContext"));
  6. const _processTailwindFeatures = /*#__PURE__*/ _interopRequireDefault(require("./processTailwindFeatures"));
  7. const _sharedState = require("./lib/sharedState");
  8. function _interopRequireDefault(obj) {
  9. return obj && obj.__esModule ? obj : {
  10. default: obj
  11. };
  12. }
  13. module.exports = function tailwindcss(configOrPath) {
  14. return {
  15. postcssPlugin: "tailwindcss",
  16. plugins: [
  17. _sharedState.env.DEBUG && function(root) {
  18. console.log("\n");
  19. console.time("JIT TOTAL");
  20. return root;
  21. },
  22. function(root, result) {
  23. let context = (0, _setupTrackingContext.default)(configOrPath);
  24. if (root.type === "document") {
  25. let roots = root.nodes.filter((node)=>node.type === "root");
  26. for (const root1 of roots){
  27. if (root1.type === "root") {
  28. (0, _processTailwindFeatures.default)(context)(root1, result);
  29. }
  30. }
  31. return;
  32. }
  33. (0, _processTailwindFeatures.default)(context)(root, result);
  34. },
  35. _sharedState.env.DEBUG && function(root) {
  36. console.timeEnd("JIT TOTAL");
  37. console.log("\n");
  38. return root;
  39. },
  40. ].filter(Boolean)
  41. };
  42. };
  43. module.exports.postcss = true;