feat: update default class names

This commit is contained in:
Marton Lederer 2021-02-20 15:45:42 +01:00
parent 3243d7c4bf
commit 91dc049c0f
No known key found for this signature in database
GPG Key ID: 9B7FD44832ADFE95

View File

@ -42,26 +42,28 @@ const postCSSPlugin = ({
// get a temporary path where we can save compiled CSS
const tmpDirPath = tmp.dirSync().name,
modulesMap: CSSModule[] = [],
pathMap: ModulePath[] = [],
modulesPlugin = postcssModules({
...(typeof modules !== "boolean" ? modules : {}),
getJSON(filepath, json, outpath) {
const tmpFilePath = pathMap.find(
({ originalPath }) => originalPath === filepath
).temporaryPath;
pathMap: ModulePath[] = [];
modulesMap.push({
path: tmpFilePath,
map: json
});
const modulesPlugin = postcssModules({
generateScopedName: "[name]__[local]___[hash:base64:5]",
...(typeof modules !== "boolean" ? modules : {}),
getJSON(filepath, json, outpath) {
const tmpFilePath = pathMap.find(
({ originalPath }) => originalPath === filepath
).temporaryPath;
if (
typeof modules !== "boolean" &&
typeof modules.getJSON === "function"
)
return modules.getJSON(filepath, json, outpath);
}
});
modulesMap.push({
path: tmpFilePath,
map: json
});
if (
typeof modules !== "boolean" &&
typeof modules.getJSON === "function"
)
return modules.getJSON(filepath, json, outpath);
}
});
build.onResolve(
{ filter: /.\.(css|sass|scss|less|styl)$/, namespace: "file" },