api-reference

tipe-loader

Last updated Invalid Date

Tipe-loader is a webpack loader that parses through your .tipe file and queries our API for you. Just write your custom GraphQL query and tipe-loader returns your data. With tipe-loader you only need to focus on your client code and nothing else.

What is a .tipe file?

The .tipe file is the easiest way to integrate with your Tipe documents and is where you write your custom GraphQL query to our API. With the .tipe file, anyone can manage and edit the content of your JSON.

graphql
query Tipe {
  Example: Test(id: "YOUR_DOCUMENT_ID") {
    test
    _meta {
      id
      name
      updatedAt
      createdAt
      published
    }
  }
}

Your output will return:

GraphQL Output

You can also query multiple documents at a time as follows:

graphql
query Tipe {
  Example: Test1(id: "Test1 document id") {
    test
    _meta {
      id
      name
      updatedAt
      createdAt
      published
    }
  }
  Example2: Test2(id: "Test2 document id") {
    test
    _meta {
      id
      name
      updatedAt
      createdAt
      published
    }
  }
}

You can test this by adding this to your JS file.

javascript
Import { example, example2 } from ‘./example.tipe’;

console.log('Test data for example: ', Example);

console.log('Test data for Example2: ', Example2);

Console output

You can also return errors at build time:

Error example