typed-css-modules
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

typed-css-modules Build Status npm version

Creates TypeScript definition files from CSS Modules .css files.

If you have the following css,

/* styles.css */
.myClass {
  color: red;
}

this creates the following .d.ts files from the above css:

/* styles.css.d.ts */
export const myClass: string;

So, you can import CSS modules in your .ts sources:

import * as styles from './styles.css';
console.log(`<div class="${styles.myClass}"></div>`);

usage

CLI

npm install -g typed-css-modules
tcm <input directory>

Then, this creates *.css.d.ts file under the directory which has original .css file.

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

file name pattern

By the default, this tool searches **/*.css files under <input directory>. If you can customize glob pattern, you can use --pattern or -p option.

tcm -p src/**/*.icss

watch

With -w or --watch, this CLI watches files in the input directory.

API

T.B.D.

License

This software is released under the MIT License, see LICENSE.txt.

Readme

Keywords

Package Sidebar

Install

npm i typed-css-modules@0.1.2

Version

0.1.2

License

MIT

Last publish

Collaborators

  • quramy