css-modules-flow-types-cli

2.0.0 • Public • Published

css-modules-flow-types-cli npm version

CLI for creating Flow type definitions based on CSS Modules files.

This gives you:

  • auto-completing for css files in most editors
  • flow type safety showing usage of non existing classes

Example

Given the following css file using CSS Modules:

@value primary: red;

.myClass {
  color: primary;
}

css-modules-flow-types creates the following .flow file next to it:

// @flow
/* This file is automatically generated by css-modules-flow-types */
declare module.exports: {|
  +'myClass': string;
  +'primary': string;
|};

Usage

$ npm install --dev css-modules-flow-types-cli
$ yarn install -D css-modules-flow-types-cli

This installs the runner as css-modules-flow-types.

And run css-modules-flow-types <input directory or glob> command.

For example, if you have .css files under src directory, exec the following:

Running,

css-modules-flow-types src

Creates *.css.flow files next to all css files.

(your project root)
- src/
    | myStyle.css
    | myStyle.css.flow [created]

Inspiration

License

This software is released under the MIT License.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    10
    • latest

Version History

Package Sidebar

Install

npm i css-modules-flow-types-cli

Weekly Downloads

10

Version

2.0.0

License

MIT

Unpacked Size

14.7 kB

Total Files

8

Last publish

Collaborators

  • skovhus