Skip to content

Commit

Permalink
add usePascalCase option (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
FuriouZz authored Oct 8, 2022
1 parent 37db460 commit 8816b08
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const {
} = require('./utils.js');
const cssHandler = require('@parcel/css');
const camelCase = require('lodash/camelCase');
const upperFirst = require('lodash/upperFirst');
const BuildCache = require('./cache.js');

/**
Expand Down Expand Up @@ -58,7 +59,13 @@ const buildCssModulesJs = async ({ fullPath, options, build }) => {
.sort() // to keep order consistent in different builds
.forEach((originClass) => {
const patchedClass = exports[originClass].name;
cssModulesJSON[camelCase(originClass)] = patchedClass;
let name = camelCase(originClass);

if (options.usePascalCase) {
name = upperFirst(name)
}

cssModulesJSON[name] = patchedClass;
});
const classNamesMapString = JSON.stringify(cssModulesJSON);

Expand Down

0 comments on commit 8816b08

Please sign in to comment.