Skip to content

Commit

Permalink
Merge cf7edd8 into 7844ed3
Browse files Browse the repository at this point in the history
  • Loading branch information
hsuanxyz committed Apr 1, 2020
2 parents 7844ed3 + cf7edd8 commit a5cb275
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/**/*.d.ts
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Example output:
| stripPrefix | Removes the `@` or `$` in the returned object keys. |

### Usage

```js
import lessToJs from 'less-vars-to-js';
import fs from 'fs';
Expand Down Expand Up @@ -84,6 +85,12 @@ export default class Palette extends Component {
}
```

use in typescript.

```ts
import * as lessToJs from 'less-vars-to-js';
```

### License

[MIT](http://michaeltaranto.mit-license.org)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "less-vars-to-js",
"version": "0.0.0-development",
"typings": "./typings.d.ts",
"description": "Read LESS variables from the contents of a file and returning them as a javascript object.",
"main": "dist/index.js",
"scripts": {
Expand Down
35 changes: 35 additions & 0 deletions typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
declare namespace lessVarsToJS {
interface Option {

/**
* Resolves variables when they are defined in the same file.
*
* @default false
*/
resolveVariables?: boolean;

/**
* When `resolveVariables` is true, passes an object to use when the value cannot be resolved in the same file.
*
* @default {}
*/
dictionary?: object;

/**
* Removes the `@` or `$` in the returned object keys.
*
* @default false
*/
stripPrefix?: boolean;
}
}

/**
* Takes in the contents of a less file as a string and returns an object containing all the variables it found
*
* @param sheet - less string
* @param option = {} - {@link lessVarsToJS.Option}
*/
declare function lessVarsToJS(sheet: string, option?: lessVarsToJS.Option): {};

export = lessVarsToJS;

0 comments on commit a5cb275

Please sign in to comment.