feat: update default class names
This commit is contained in:
parent
3243d7c4bf
commit
91dc049c0f
38
src/index.ts
38
src/index.ts
@ -42,26 +42,28 @@ const postCSSPlugin = ({
|
|||||||
// get a temporary path where we can save compiled CSS
|
// get a temporary path where we can save compiled CSS
|
||||||
const tmpDirPath = tmp.dirSync().name,
|
const tmpDirPath = tmp.dirSync().name,
|
||||||
modulesMap: CSSModule[] = [],
|
modulesMap: CSSModule[] = [],
|
||||||
pathMap: ModulePath[] = [],
|
pathMap: ModulePath[] = [];
|
||||||
modulesPlugin = postcssModules({
|
|
||||||
...(typeof modules !== "boolean" ? modules : {}),
|
|
||||||
getJSON(filepath, json, outpath) {
|
|
||||||
const tmpFilePath = pathMap.find(
|
|
||||||
({ originalPath }) => originalPath === filepath
|
|
||||||
).temporaryPath;
|
|
||||||
|
|
||||||
modulesMap.push({
|
const modulesPlugin = postcssModules({
|
||||||
path: tmpFilePath,
|
generateScopedName: "[name]__[local]___[hash:base64:5]",
|
||||||
map: json
|
...(typeof modules !== "boolean" ? modules : {}),
|
||||||
});
|
getJSON(filepath, json, outpath) {
|
||||||
|
const tmpFilePath = pathMap.find(
|
||||||
|
({ originalPath }) => originalPath === filepath
|
||||||
|
).temporaryPath;
|
||||||
|
|
||||||
if (
|
modulesMap.push({
|
||||||
typeof modules !== "boolean" &&
|
path: tmpFilePath,
|
||||||
typeof modules.getJSON === "function"
|
map: json
|
||||||
)
|
});
|
||||||
return modules.getJSON(filepath, json, outpath);
|
|
||||||
}
|
if (
|
||||||
});
|
typeof modules !== "boolean" &&
|
||||||
|
typeof modules.getJSON === "function"
|
||||||
|
)
|
||||||
|
return modules.getJSON(filepath, json, outpath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
build.onResolve(
|
build.onResolve(
|
||||||
{ filter: /.\.(css|sass|scss|less|styl)$/, namespace: "file" },
|
{ filter: /.\.(css|sass|scss|less|styl)$/, namespace: "file" },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user