4.2.0 • Published 6 months ago

postcss-modules-local-by-default v4.2.0

Weekly downloads
12,294,057
License
MIT
Repository
github
Last release
6 months ago

Build Status codecov npm

CSS Modules: Local by Default

Transformation examples:

Selectors (mode local, by default)::

.foo { ... } /* => */ :local(.foo) { ... }

.foo .bar { ... } /* => */ :local(.foo) :local(.bar) { ... }

/* Shorthand global selector */

:global .foo .bar { ... } /* => */ .foo .bar { ... }

.foo :global .bar { ... } /* => */ :local(.foo) .bar { ... }

/* Targeted global selector */

:global(.foo) .bar { ... } /* => */ .foo :local(.bar) { ... }

.foo:global(.bar) { ... } /* => */ :local(.foo).bar { ... }

.foo :global(.bar) .baz { ... } /* => */ :local(.foo) .bar :local(.baz) { ... }

.foo:global(.bar) .baz { ... } /* => */ :local(.foo).bar :local(.baz) { ... }

Declarations (mode local, by default):

.foo {
  animation-name: fadeInOut, global(moveLeft300px), local(bounce);
}

.bar {
  animation: rotate 1s, global(spin) 3s, local(fly) 6s;
}

/* => */ 

:local(.foo) {
  animation-name: :local(fadeInOut), moveLeft300px, :local(bounce);
}

:local(.bar) {
  animation: :local(rotate) 1s, spin 3s, :local(fly) 6s;
}

Pure Mode

In pure mode, all selectors must contain at least one local class or id selector

To ignore this rule for a specific selector, add the a /* cssmodules-pure-ignore */ comment in front of the selector:

/* cssmodules-pure-ignore */
:global(#modal-backdrop) {
  ...;
}

or by adding a /* cssmodules-pure-no-check */ comment at the top of a file to disable this check for the whole file:

/* cssmodules-pure-no-check */

:global(#modal-backdrop) {
  ...;
}

:global(#my-id) {
  ...;
}

Building

$ npm install
$ npm test
  • Build: Build Status
  • Lines: coveralls
  • Statements: codecov

Development

$ yarn test:watch

License

MIT

With thanks


Mark Dalgleish, 2015.

css-loaderpostcss-modulescomponennenttvuedragdropuploadimagescloud-archive-s3bb-chat@fundefund/funde_cksxyj_taro_cligql_din_mod@l1nyanm1ng/react-picture-viewer@olivervorasai/slidercbmis-ai-toolboxasterjscogoportutils@infinitebrahmanuniverse/nolb-postcss-m@saaspe/componentsexpand-react-bridgesklif-ui-kitsklif-api@everything-registry/sub-chunk-2461@cositehq/typed-css-modulesp149-tabletest-popupssklif-uilapture-ui-complaptureuidrpdwn-mntaman-baca-masyarakattape-babel-css-modulestagged-css-modulesta-css-loaderwinx-form-winxvusion-css-loadervue-button-test1webdesa-laravel-final-releasewebpack_component_fundwescheme-jsteapackage-tatespoorman297stories-fsstories-react-bdsticky-scroll-catchtestapatestujsk_custom_ckeditor5svelte-component-libthemre-sienna-accessibilityvue-compmentvision-css-loadervite-css-modulesvs-tree-plusvue-bomb@digitalrakesh/jsui@dimcheify/dimui@drblmthw/testujsk_custom_ckeditor5@ct-note/table@ct-note/warning@ct-note/image@ct-note/inline-code@ct-note/list@ct-note/marker@ct-note/paragraph@ct-note/quote@ct-note/simple-image@ct-note/checklist@ct-note/code@ct-note/delimiter@ct-note/embed@ct-note/header@dallonf/css-modules-require-hook@dallonf/tape-babel-css-modules@d-bigfish/cli@dinert/component@demonarchy/babel-plugin-react-css-modules@demoflow/nested-list@demching113/css-modules-loader-core@dr.pogodin/babel-plugin-react-css-modules@dr.pogodin/css-modules-require-hook@cameron-martin/css-modules-loader-core@blkmarketco/components-library@beldore/react-otp-input@percent/percent-api-hooks@rune-ts/servergenerator-bootstrap-boilerplate-templatejdseal-cliitemjsjest-css-modules-processorjesusdemojulien-easy-modaljson-categorizejetbolt-reactkafirchain-tetrisk0ng_d1nosaur_quenak0ng_d1nosaur_quenbk0ng_d1nosaur_quenck0ng_d1nosaur_quendk0ng_d1nosaur_quenek0ng_d1nosaur_quenfk0ng_d1nosaur_quengk0ng_d1nosaur_quenhk0ng_d1nosaur_quenik0ng_d1nosaur_quenj
4.1.0

7 months ago

4.2.0

6 months ago

4.0.5

1 year ago

4.0.4

1 year ago

4.0.1

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

4.0.0

5 years ago

4.0.0-rc.4

5 years ago

4.0.0-rc.3

5 years ago

4.0.0-rc.2

5 years ago

4.0.0-rc.1

5 years ago

4.0.0-rc.0

5 years ago

3.0.3

5 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.2.0

8 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

10 years ago

1.0.0-beta2

10 years ago

1.0.0-beta1

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago