---
url: /reference/@cssdoc/index/functions/createIndex.md
---
# Function: createIndex()

```ts
function createIndex(css, options?): CssDocIndex;
```

Defined in: [packages/index/src/index.ts:527](https://github.com/thedannywahl/cssdoc/blob/main/packages/index/src/index.ts#L527)

Build an index from CSS, with source spans. Parses the model via `@cssdoc/core`, then makes a second
PostCSS pass to locate each record and member.

## Parameters

### css

`string`

The CSS source.

### options?

`file` (attached to locations) and `configuration` (custom tags).

#### configuration?

[`CssDocConfiguration`](../../core/classes/CssDocConfiguration.md)

#### file?

`string`

#### modifierConvention?

[`ModifierConventionInput`](../../core/type-aliases/ModifierConventionInput.md)

#### parse?

(`css`) => `Root_`

The PostCSS parser (inject a dialect parser for `.scss`/`.less`; default `postcss.parse`).

## Returns

[`CssDocIndex`](../classes/CssDocIndex.md)

The index.
