Skip to content

Eliminating unused classes #127

Description

@BaoDelta

Let's say I have the following code:

/* test.css */

.roundedBorder {
  border-radius: 5px;
}

.redBorder {
  border: 1px solid red;
}

.roundedAndRedBorder {
  composes: roundedBorder;
  composes: redBorder;
}
/* test.js */
import styles from './test.css'

console.log(styles)

When I run the code with style loader and css loader, the output is:

{
  "roundedBorder": "test__roundedBorder",
  "redBorder": "test__redBorder",
  "roundedAndRedBorder": "test__roundedAndRedBorder test__roundedBorder test__redBorder"
}

and the style element added into DOM is:

<style type="text/css">
.test__roundedBorder {
  border-radius: 5px;
}

.test__redBorder {
  border: 1px solid red;
}

.test__roundedAndRedBorder {
}
</style>

The class roundedAndRedBorder is used here only to compose the two other classes. Therefore, I think we should not have the class test__roundedAndRedBorder in the output. What do you think?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions