weapp-tailwindcss
Version:
把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!
46 lines (42 loc) • 963 B
JavaScript
// src/utils/index.ts
import { defu, defuOverrideArray, groupBy, isMap, isRegexp, noop, regExpTest, removeExt } from "@weapp-tailwindcss/shared";
// src/utils/hbuilderx.ts
import path from "path";
import process from "process";
// src/utils/index.ts
function classifyEntry(filename, options) {
if (options.cssMatcher(filename)) {
return "css";
}
if (options.htmlMatcher(filename)) {
return "html";
}
if (options.jsMatcher(filename) || options.wxsMatcher(filename)) {
return "js";
}
return "other";
}
function createEmptyGroups() {
return {
css: [],
html: [],
js: [],
other: []
};
}
function getGroupedEntries(entries, options) {
const groups = createEmptyGroups();
for (const entry of entries) {
const [filename] = entry;
const group = classifyEntry(filename, options);
groups[group].push(entry);
}
return groups;
}
export {
defu,
defuOverrideArray,
isMap,
noop,
getGroupedEntries
};