Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ npm install --save-dev css-typed
Run `css-typed` and pass it a glob targeting your CSS files.

```shell
npx css-typed 'src/**/*.css'
npx css-typed "src/**/*.css"
```

This will generate `.d.css.ts` files next to the original source files.

> **Note**
See the [run script recipe](#run-script) for adding to your `package.json`.

> [!NOTE]
>
> A CSS module file with the name `foo.module.css` will emit `foo.module.d.css.ts`.

Expand Down Expand Up @@ -114,7 +116,7 @@ For example, `my-class` becomes `myClass` and you cannot use `my-class` in JS/TS
Modern bundlers or build system such as Vite and Gatsby support this transformation.
The default matches CSS naming practices (`kebab-case`).

> **IMPORTANT**
> [!IMPORTANT]
>
> Note that `camelCase` and `dashes` MAY have TypeScript bugs.
> TypeScript 5.6 may help with the named exports for these.
Expand All @@ -127,18 +129,23 @@ The default matches CSS naming practices (`kebab-case`).

### Run script

To run it as part of your build, you will likely include it as a run script, maybe as `codegen` or `pretsc`.
To run it as part of your build, you will likely include it as a run script, maybe as `codegen`, `css-typed`, or `pretsc`.

```json
{
"scripts": {
"codegen": "css-typed \"src/**/*.css\"",
"css-typed": "css-typed \"src/**/*.css\"",
"pretsc": "css-typed \"src/**/*.css\"",
"tsc": "tsc"
}
}
```

> [!NOTE]
>
> Use `\"` in your run scripts for Windows OS compatibility.

### Watch

The CLI does not have built-in watch support.
Expand Down