open-index/open-npm huggingface dataset:
npm package: @sempro/nuxt-prismic
Description: Nuxt plugin for injecting and transforming the Prismic REST API
Latest version: 0.1.1

# nuxt-prismic
> Nuxt plugin for injecting and transforming the Prismic REST API

[![Build Status](https://travis-ci.com/sempro/nuxt-prismic.svg?token=x7iFywRHC1KDHUep7c3W&branch=master)](https://travis-ci.com/sempro/nuxt-prismic)
[![eslint](https://img.shields.io/badge/code_style-airbnb-blue.svg)](https://github.com/airbnb/javascript)

### Installation
#### Install with NPM
```bash
npm install @sempro/nuxt-prismic --save
```

#### Add to `nuxt.config.js`
```js
modules: [
  '@sempro/nuxt-prismic',
],
```

### API
#### `app.$prismic.api`
Instantiated api endpoint

#### `app.$prismic.experimentCookie`
Experiment cookie exposed from `prismic-javascript`

#### `app.$prismic.previewCookie`
Preview cookie exposed from `prismic-javascript`

#### `app.$prismic.predicates`
Prismic Predicates. Read more here, [Query Predicates Reference in Javascript](https://prismic.io/docs/javascript/query-the-api/query-predicates-reference) and [Use Multiple Predicates in Javascript](https://prismic.io/docs/javascript/query-the-api/use-multiple-predicates)

### Usage
#### Example Vue component
```vue
<template>
  <div>
    <h1>{{ post.title }}</h1>
  </div>
</template>

<script>
  export default {
    async asyncData({ app }) {
      const post = await app.$prismic.api.getByID('PRISMIC-DOCUMENT-ID');

      return { post };
    },
  };
</script>
```

### Testing
```bash
# Unit tests
npm t

# Code style
npm run eslint
```