Skip to content

Commit a4441ce

Browse files
authored
feat: update DOCS and bump dependencies (#83)
1 parent 76d75d6 commit a4441ce

File tree

4 files changed

+706
-614
lines changed

4 files changed

+706
-614
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ When a custom renderer is provided, not other renderers will be used.
122122

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

125-
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.
125+
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.
126126

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

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

142-
> 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)
142+
> If you use Webpack, note that tilde (`~`) imports not supported by Less and Sass natively.
143+
>
144+
> For Less users, this package exports a customRenderer that enables tilde imports: [`less-plugin-aliases`](https://github.com/dancon/less-plugin-aliases).
143145
144146
#### `customTemplate`
145147

package.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
]
5858
},
5959
"prettier": {
60-
"arrowParens": "always",
6160
"singleQuote": true,
6261
"trailingComma": "all"
6362
},
@@ -74,30 +73,30 @@
7473
"postcss-icss-selectors": "^2.0.3",
7574
"postcss-load-config": "^2.1.0",
7675
"reserved-words": "^0.1.2",
77-
"sass": "^1.26.1"
76+
"sass": "^1.26.5"
7877
},
7978
"devDependencies": {
8079
"@types/icss-utils": "^4.1.0",
81-
"@types/jest": "^25.1.3",
80+
"@types/jest": "^25.2.1",
8281
"@types/less": "^3.0.1",
8382
"@types/lodash.camelcase": "^4.3.6",
8483
"@types/node": "^12.12.17",
8584
"@types/postcss-load-config": "^2.0.1",
8685
"@types/postcss-nested": "^4.1.0",
8786
"@types/reserved-words": "^0.1.0",
8887
"@types/sass": "^1.16.0",
89-
"@typescript-eslint/eslint-plugin": "^2.21.0",
90-
"@typescript-eslint/parser": "^2.21.0",
88+
"@typescript-eslint/eslint-plugin": "^2.29.0",
89+
"@typescript-eslint/parser": "^2.29.0",
9190
"bootstrap": "4.4.1",
9291
"eslint": "^6.8.0",
93-
"eslint-config-prettier": "^6.10.0",
94-
"husky": "^4.2.3",
95-
"jest": "^25.1.0",
96-
"lint-staged": "^10.0.8",
92+
"eslint-config-prettier": "^6.11.0",
93+
"husky": "^4.2.5",
94+
"jest": "^25.4.0",
95+
"lint-staged": "^10.1.7",
9796
"postcss-import-sync2": "^1.1.0",
98-
"prettier": "^1.19.1",
99-
"ts-jest": "^25.2.1",
100-
"typescript": "^3.8.2"
97+
"prettier": "^2.0.5",
98+
"ts-jest": "^25.4.0",
99+
"typescript": "^3.8.3"
101100
},
102101
"peerDependencies": {
103102
"typescript": "^3.0.0"

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function init({ typescript: ts }: { typescript: typeof tsModule }) {
8484
} else {
8585
logger.error(
8686
new Error(
87-
`Invalid 'customRenderer', '${options.customRenderer}' does not exist.`,
87+
`The file or package for \`customRenderer\` '${options.customRenderer}' could not be resolved.`,
8888
),
8989
);
9090
}

0 commit comments

Comments
 (0)