Skip to content

Commit

Permalink
docs: Update README.md with more a detalied example
Browse files Browse the repository at this point in the history
Show directory tree and use relative paths in the example.
  • Loading branch information
leosuncin committed Jan 28, 2019
1 parent bac9499 commit 2ac1f60
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions README.md
Expand Up @@ -13,12 +13,25 @@ yarn add --dev graphql-import-loader

## Usage

Resolve GraphQL file import statements as a string. See the tests for more details
Resolve GraphQL file import statements with relative paths. See the tests for more details

```
.
├── src
│   ├── index.js
│   └── schema
│   ├── a.graphql
│   ├── b.graphql
│   ├── main.graphql
│   └── subdir
│   └── cd.graphql
└── webpack.config.js
```

```graphql
# import { A } from 'src/schema/a.graphql'
# import { B } from 'src/schema/b.graphql'
# import { C, D } from 'src/schema/cd.graphql'
# import { A } from './a.graphql'
# import { B } from './b.graphql'
# import { C, D } from './subdir/cd.graphql'

type Complex {
id: ID!
Expand All @@ -30,7 +43,7 @@ type Complex {
```

```js
import typeDefs from './schema.graphql'
import typeDefs from './schema/main.graphql'
```

```js
Expand Down

0 comments on commit 2ac1f60

Please sign in to comment.