JSPM

  • Created
  • Published
  • Downloads 117927
  • Score
    100M100P100Q158538F
  • License MIT

Creates .d.ts files from css-modules' .css files

Package Exports

  • typed-css-modules

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (typed-css-modules) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

typed-css-modules Build Status npm version

Creates TypeScript definition files from css-modules .css files.

If you have the following css,

.myClass {
  color: red;
}

this creates the following .d.ts files from it:

export const myClass: string;

So, you can use 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.