Skip to content

Move to lowercase postcss #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2021
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ for [CSS Modules](https://github.com/css-modules/css-modules).
- [`classnameTransform`](#classnametransform)
- [`customRenderer`](#customrenderer)
- [`customTemplate`](#customtemplate)
- [`postCssOptions`](#postcssoptions)
- [`postcssOptions`](#postcssoptions)
- [`rendererOptions`](#rendereroptions)
- [Visual Studio Code](#visual-studio-code)
- [Recommended usage](#recommended-usage)
Expand Down Expand Up @@ -105,7 +105,7 @@ Please note that no options are required. However, depending on your configurati
| `customTemplate` | `false` | See [`customTemplate`](#customTemplate) below. |
| `namedExports` | `true` | Enables named exports for compatible classnames. |
| `dotenvOptions` | `{}` | Provides options for [`dotenv`](https://github.com/motdotla/dotenv#options). |
| `postCssOptions` | `{}` | See [`postCssOptions`](#postCssOptions) below. |
| `postcssOptions` | `{}` | See [`postcssOptions`](#postcssOptions) below. |
| `rendererOptions` | `{}` | See [`rendererOptions`](#rendererOptions) below. |

```json
Expand All @@ -119,7 +119,7 @@ Please note that no options are required. However, depending on your configurati
"customMatcher": "\\.m\\.css$",
"customRenderer": "./myRenderer.js",
"dotenvOptions": {},
"postCssOptions": {},
"postcssOptions": {},
"rendererOptions": {}
}
}
Expand Down Expand Up @@ -192,7 +192,7 @@ The [internal `logger`](https://github.com/mrmckeb/typescript-plugin-css-modules

The `classes` object represents all the classnames extracted from the CSS Module. They are available if you want to add a custom representation of the CSS classes.

#### `postCssOptions`
#### `postcssOptions`

| Option | Default value | Description |
| ---------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------- |
Expand Down
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ function init({ typescript: ts }: { typescript: typeof tsModule }) {
}

// Add postCSS config if enabled.
const postCssOptions = options.postCssOptions || {};
const postcssOptions =
options.postcssOptions || options.postCssOptions || {};

let userPlugins: AcceptedPlugin[] = [];
if (postCssOptions.useConfig) {
if (postcssOptions.useConfig) {
const postcssConfig = getPostCssConfigPlugins(directory);
userPlugins = [
filter({
exclude: postCssOptions.excludePlugins,
exclude: postcssOptions.excludePlugins,
silent: true,
}),
...postcssConfig,
Expand Down
6 changes: 4 additions & 2 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Logger } from './helpers/logger';
// NOTE: Stylus doesn't directly export RenderOptions.
type StylusRenderOptions = Parameters<typeof stylus>[1];

export interface PostCssOptions {
export interface PostcssOptions {
excludePlugins?: string[];
useConfig?: boolean;
}
Expand All @@ -26,7 +26,9 @@ export interface Options {
customTemplate?: string;
dotenvOptions?: DotenvConfigOptions;
namedExports?: boolean;
postCssOptions?: PostCssOptions;
postcssOptions?: PostcssOptions;
/** @deprecated To align with other projects. */
postCssOptions?: PostcssOptions;
rendererOptions?: RendererOptions;
}

Expand Down