Skip to content

Commit

Permalink
feat(jit): generate important (!) modifier before classnames
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadsammy committed Apr 11, 2021
1 parent c95cef5 commit 9a3b64f
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/cli/core/ClassnamesGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,17 +401,34 @@ export class ClassnamesGenerator {
_.has(this._generatedRegularClassnames[key as keyof TAllClassnames], regularClassGroupKey)
) {
// Get the value of the found generated class group
const generatedClassGroup = _.get(
let generatedClassGroup = _.get(
this._generatedRegularClassnames,
`${key}.${regularClassGroupKey}`,
) as string[];

// If JIT compiler mode is enabled...
if (this.isJitModeEnabled()) {
// Duplicate classnames with an important (!) prefix
const generatedClassGroupWithImportantPrefix = generatedClassGroup.map(
cls => '!' + cls,
);

// Append the classnames with important prefix to the regular classnames
generatedClassGroup = generatedClassGroup.concat(
generatedClassGroupWithImportantPrefix,
);

// Append the classnames with important prefix to the pseudo classes array
generatedClassGroupWithImportantPrefix.map(cls => pseudoClasses.push(cls));
}

// For every member of the found regular classes group...
generatedClassGroup.map(classname => {
const isDarkModeEnabled = this._darkMode !== false;

// If JIT compiler mode is enabled, enable all variants...
// If JIT compiler mode is enabled...
if (this.isJitModeEnabled()) {
// Enable all variants
pseudoClassesVariantsForKey = allVariants;
}

Expand Down

0 comments on commit 9a3b64f

Please sign in to comment.