Skip to content

Commit

Permalink
Update peerDependencies to support version 3 of css-loader
Browse files Browse the repository at this point in the history
Closes #13
  • Loading branch information
Alexander Grigoriev committed Jan 17, 2020
1 parent 690480c commit 44563e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# dts-css-modules-loader
Replacement for the [typings-for-css-modules-loader](https:/Jimdo/typings-for-css-modules-loader). This loader does not make any changes in content of styles, just creates `*.d.ts` file during the work. It is assumed that the content will be preprocessed first by [css-loader](https:/webpack-contrib/css-loader).
Replacement for the [typings-for-css-modules-loader](https:/Jimdo/typings-for-css-modules-loader). This loader does not make any changes in content of styles, just creates `*.d.ts` file during the work. It is assumed that the content will be preprocessed first by [css-loader](https:/webpack-contrib/css-loader). Currently supported versions 2 and 3 of the `css-loader`.

## Installation
```bash
Expand All @@ -23,16 +23,18 @@ yarn add -D dts-css-modules-loader
{
loader: 'css-loader',
options: {
modules: true, // this option must be enabled
camelCase: 'only',
localIdentName: '[local]',
exportOnlyLocals: true
modules: { // this option must be enabled
localIdentName: '[local]'
}
localsConvention: 'camelCaseOnly',
onlyLocals: true
}
},
'sass-loader'
]
}
```
`css-loader` options presented for the third version.

## Options
### `namedExport`
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ function getClasses(content) {
/** @type {string[]} */
let classes = [];

// when `exportOnlyLocals` is on
// when `onlyLocals` is on
let from = content.indexOf('module.exports = {');
// when `exportOnlyLocals` is off
// when `onlyLocals` is off
from = ~from ? from : content.indexOf('exports.locals = {');

if (~from) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "dts-css-modules-loader",
"version": "1.0.1",
"version": "1.0.2",
"description": "webpack loader to generate typings for css modules",
"dependencies": {
"loader-utils": "^1.2.0"
},
"peerDependencies": {
"css-loader": "^2.0.2"
"css-loader": "^2.0.0 || ^3.0.0"
},
"keywords": [
"css-modules",
Expand Down

0 comments on commit 44563e5

Please sign in to comment.