Skip to content

Commit

Permalink
docs: update readme with new feature
Browse files Browse the repository at this point in the history
  • Loading branch information
skovy committed Feb 14, 2022
1 parent c8c39c0 commit 422a56e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 5 deletions.
49 changes: 45 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ npm install -D typed-scss-modules
./node_modules/.bin/typed-scss-modules src
```

## Advanced Usage
## CLI Options

For all possible commands, run `typed-scss-modules --help`.

Expand Down Expand Up @@ -279,12 +279,53 @@ export type Styles = {
};
```

## Config options

All options above are also supported as a configuration file in the root of the project. The following configuration file names are supported:

- `typed-scss-modules.config.ts`
- `typed-scss-modules.config.js`

The file can provide either a named `config` export or a default export.

```js
// Example of a named export with some of the options sets.
export const config = {
banner: "// customer banner",
exportType: "default",
exportTypeName: "TheClasses",
logLevel: "error",
};

// Example of a default export with some of the options sets.
export default {
banner: "// customer banner",
exportType: "default",
exportTypeName: "TheClasses",
logLevel: "error",
};
```

> Note: the configuration options are the same as the CLI options without the leading dashes (`--`). Only the full option name is supported (not aliases) in the configuration file.
CLI options will take precedence over configuration file options.

In addition to all CLI options, the following are options only available with the configuration file:

### `importer`

- **Type**: `Importer | Importer[]`
- **Default**: _none_

Define a [single custom SASS importer or an array of SASS importers](https://github.com/sass/sass/blob/f355f602fc15f55b0a0a795ebe6eb819963e08a5/js-api-doc/legacy/importer.d.ts#L51-L149). This should only be necessary if custom SASS importers are already being used in the build process. This is used internally to implement `aliases` and `aliasPrefixes`.

## Examples

For examples, see the `examples` directory:
For examples of how this tool can be used and configured, see the `examples` directory:

- [Basic Example](/examples/basic)
- [Default Export Example](/examples/default-export)
- [Basic example](/examples/basic)
- [Default export example](/examples/default-export)
- [Config file (with custom importer) example](/examples/config-file)

## Contributors ✨

Expand Down
1 change: 0 additions & 1 deletion __tests__/dummy-styles/typed-scss-modules.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export const config = {
exportTypeInterface: "Styles",
listDifferent: false,
ignore: [],
implementation,
quoteType: "single",
updateStaleOnly: false,
logLevel: "verbose",
Expand Down

0 comments on commit 422a56e

Please sign in to comment.