@sempro/nuxt-prismic
v0.1.1
Published
Nuxt plugin for injecting and transforming the Prismic REST API
Downloads
9
Readme
nuxt-prismic
Nuxt plugin for injecting and transforming the Prismic REST API
Installation
Install with NPM
npm install @sempro/nuxt-prismic --save
Add to nuxt.config.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 and Use Multiple Predicates in Javascript
Usage
Example Vue component
<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
# Unit tests
npm t
# Code style
npm run eslint