weapp-tailwindcss
Version:
把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!
60 lines (52 loc) • 1.82 kB
JavaScript
Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
var _chunkNS3NEDWDjs = require('../chunk-NS3NEDWD.js');
require('../chunk-BZ6OV5EP.js');
// src/css-macro/postcss.ts
var creator = () => {
return {
postcssPlugin: "postcss-weapp-tw-css-macro-plugin",
prepare() {
return {
AtRule(atRule, helper) {
if (atRule.name === "media") {
const values = [];
_chunkNS3NEDWDjs.matchCustomPropertyFromValue.call(void 0, atRule.params, (arr) => {
values.push(arr[1]);
});
if (values.length > 0) {
const isNegative = atRule.params.includes("not");
const text = values.join(" ");
const comment = isNegative ? _chunkNS3NEDWDjs.ifndef.call(void 0, text) : _chunkNS3NEDWDjs.ifdef.call(void 0, text);
atRule.replaceWith([
helper.comment({
raws: {
before: "\n"
},
text: comment.start
}),
..._nullishCoalesce(atRule.nodes, () => ( [])),
// .map((x) => x.clone()),
helper.comment({
raws: {
before: "\n"
},
text: comment.end
})
]);
}
}
},
CommentExit(comment) {
if (/#(?:ifn?def|endif)/.test(comment.text)) {
comment.raws.left = " ";
comment.raws.right = " ";
}
}
};
}
};
};
creator.postcss = true;
var postcss_default = creator;
exports.default = postcss_default;
module.exports = exports.default;
;