Skip to content

feat: update DOCS and bump dependencies #83

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
Apr 27, 2020
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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ When a custom renderer is provided, not other renderers will be used.

The path to the `customRenderer` must be relative to the project root (i.e. `./myRenderer.js`).

The custom renderer itself should be a JavaScript file. The function will be called with three arguments: a `css` string, an `options` object and an `compilerOptions` object that is defined in `tsconfig.json` the `tsc` used. (see [`options.ts`](https://github.com/mrmckeb/typescript-plugin-css-modules/blob/master/src/options.ts#L33-L41)). It must be synchronous, and must return valid CSS.
The custom renderer itself should be a JavaScript file. The function will be called with three arguments: a `css` string, an `options` object (see [`options.ts`](https://github.com/mrmckeb/typescript-plugin-css-modules/blob/master/src/options.ts#L33-L41)), and a `compilerOptions` object - which contains options as set in your `tsconfig.json`. It must be synchronous, and must return valid CSS.

```js
module.exports = (css, { fileName, logger }) => {
Expand All @@ -139,7 +139,9 @@ You can find an example custom renderer in our test fixtures ([`customRenderer.j

The [internal `logger`](https://github.com/mrmckeb/typescript-plugin-css-modules/blob/master/src/helpers/logger.ts) is provided for [debugging](#troubleshooting).

> Note: If you are working with webpack and [`less-loader`](https://www.npmjs.com/package/less-loader), you can choose resolver that webpack provided and webpack will resolve the `@import` file path that start with `~`, but `~` is not support by less natively, and the plugin will break down, then we can use `less-plugin-aliases` npm package make it works again, more details can find [here](https://github.com/mrmckeb/typescript-plugin-css-modules/issues/77) and [here](https://github.com/dancon/less-plugin-aliases)
> If you use Webpack, note that tilde (`~`) imports not supported by Less and Sass natively.
>
> For Less users, this package exports a customRenderer that enables tilde imports: [`less-plugin-aliases`](https://github.com/dancon/less-plugin-aliases).

#### `customTemplate`

Expand Down
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
]
},
"prettier": {
"arrowParens": "always",
"singleQuote": true,
"trailingComma": "all"
},
Expand All @@ -74,30 +73,30 @@
"postcss-icss-selectors": "^2.0.3",
"postcss-load-config": "^2.1.0",
"reserved-words": "^0.1.2",
"sass": "^1.26.1"
"sass": "^1.26.5"
},
"devDependencies": {
"@types/icss-utils": "^4.1.0",
"@types/jest": "^25.1.3",
"@types/jest": "^25.2.1",
"@types/less": "^3.0.1",
"@types/lodash.camelcase": "^4.3.6",
"@types/node": "^12.12.17",
"@types/postcss-load-config": "^2.0.1",
"@types/postcss-nested": "^4.1.0",
"@types/reserved-words": "^0.1.0",
"@types/sass": "^1.16.0",
"@typescript-eslint/eslint-plugin": "^2.21.0",
"@typescript-eslint/parser": "^2.21.0",
"@typescript-eslint/eslint-plugin": "^2.29.0",
"@typescript-eslint/parser": "^2.29.0",
"bootstrap": "4.4.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"husky": "^4.2.3",
"jest": "^25.1.0",
"lint-staged": "^10.0.8",
"eslint-config-prettier": "^6.11.0",
"husky": "^4.2.5",
"jest": "^25.4.0",
"lint-staged": "^10.1.7",
"postcss-import-sync2": "^1.1.0",
"prettier": "^1.19.1",
"ts-jest": "^25.2.1",
"typescript": "^3.8.2"
"prettier": "^2.0.5",
"ts-jest": "^25.4.0",
"typescript": "^3.8.3"
},
"peerDependencies": {
"typescript": "^3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function init({ typescript: ts }: { typescript: typeof tsModule }) {
} else {
logger.error(
new Error(
`Invalid 'customRenderer', '${options.customRenderer}' does not exist.`,
`The file or package for \`customRenderer\` '${options.customRenderer}' could not be resolved.`,
),
);
}
Expand Down
Loading