@sempro/nuxt-prismic

0.1.1 • Public • Published

nuxt-prismic

Nuxt plugin for injecting and transforming the Prismic REST API

Build Status eslint

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

Readme

Keywords

none

Package Sidebar

Install

npm i @sempro/nuxt-prismic

Weekly Downloads

0

Version

0.1.1

License

none

Unpacked Size

7.38 kB

Total Files

8

Last publish

Collaborators

  • ecrmnn
  • sempro.no
  • ventrec