madyankin / madyankin/postcss-modules

global css order error

Open
#107 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.6k
Forks
88
PR merge metrics
No merged PRs in 30d

Description

I use postcss-modules to handle antd in parcel.

// global.less
@import '~antd/dist/antd.less';
// App.tsx
import '../styles/global.less'

function App(){
 return <Box/>
}
// Box.tsx
import styles from './index.module.scss'
export default function Box() {

  return (
    <Form className={styles['filter-form']}  >
    </Form>
  )
}
// index.module.scss
.filter-form {
  position: relative;
  margin: 20px 0;
  padding: 8px 200px 24px 24px;
  background: #fff;
}
// postcss.config.js

module.exports = {
  modules: true,
  plugins: {
    autoprefixer: {
      grid: true,
    },
    'postcss-modules': {
      globalModulePaths: ['./styles/global.less'],
    },
  },
}

I find the global.less is placed at the bottom and has more priority.
But the module.scss should have higher priority.

demo like this parcel-antd

Anything to deal with it?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the ordering issue using the mentioned global.less, App.tsx, Box.tsx, index.module.scss, and postcss.config.js files, or the linked parcel-antd demo. Inspect how the global stylesheet and CSS Module are collected and emitted, then define completion as either consistent module precedence or clear documentation of the supported configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript, scss, typescript
Domain
frontend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.