项目作者: tivac

项目描述 :
A streamlined reinterpretation of CSS Modules via CLI, API, Browserify, Rollup, Webpack, or PostCSS
高级语言: JavaScript
项目地址: git://github.com/tivac/modular-css.git
创建时间: 2015-10-29T00:20:23Z
项目社区:https://github.com/tivac/modular-css

开源协议:MIT License

下载


modular-css GitHub license GitHub Workflow Status GitHub issues Discord

A streamlined re-interpretation of CSS Modules

Documentation

Check out the official modular-css site: http://m-css.com/

Try it

There’s an online REPL where you can try out modular-css without needing to install anything!

http://m-css.com/repl

Features

Composition

  1. .red {
  2. color: red;
  3. }
  4. .blue {
  5. composes: red;
  6. background: blue;
  7. }
  8. /* in the output .blue will be combination of both styles */

Values

  1. @value alert: #F00;
  2. .alert {
  3. color: alert;
  4. }
  5. /* will output as */
  6. .alert {
  7. color: #F00;
  8. }

Selector Scoping

  1. .style {
  2. color: red;
  3. }
  4. :global(.style2) {
  5. color: blue;
  6. }
  7. /* Will output as */
  8. /* Scoped with unique file-based prefix */
  9. .f5507abd_style {
  10. color: red;
  11. }
  12. /* Remains unstyled due to :global() pseudo */
  13. .style2 {
  14. color: blue;
  15. }

Style Overrides

  1. /* input.css */
  2. .input {
  3. width: 100%;
  4. }
  5. /* fieldset.css */
  6. .fieldset :external(input from "./input.css") {
  7. width: 50%;
  8. }

More detailed descriptions are available on the website.

Install

Detailed installation instructions are available on m-css.com

https://m-css.com/overview/#introduction-how