Skip to content

postcss nesting only works with '.' as nested class #118

Closed
@odc-john

Description

@odc-john

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

vscode

  "typescript.tsserver.pluginPaths": ["typescript-plugin-css-modules"]

tsconfig

 {
        "name": "typescript-plugin-css-modules",
        "options": {
          "useConfig": true
        }
      }

postcss config

module.exports = {
  plugins: {
    'postcss-import': {},
    'postcss-nested': {},
    'postcss-custom-media': {
      importFrom: __dirname + '/src/styles/variables/media.css'
    },
    // TODO: remove after demo
    // demo of css after minify. specifically merging media
    'postcss-pxtorem': {
      propList: ['*'],
      mediaQuery: true
    }
  }
};

Should be able to styles.TagBar. Only Tag shows

.Tag {
  position: relative;

  display: flex;
  width: 118px;
  height: 38px;

  color: var(--tag-color);

  background: var(--tag-bg);

  border-radius: 3px;

  &Bar {
    width: 4px;
    height: 100%;

    background: var(--tag-bar-bg);

    border-top-left-radius: 3px;
    border-bottom-left-radius: 3px;
  }

  &Label {
    display: flex;
    flex-grow: 1;
    align-items: center;
    justify-content: center;
    margin: 4px;

    font-weight: 500;
    font-size: 14px;
  }
}

Using '.' in nested shows styles.Bar

.Tag {
&.Bar {}
}
  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions