JSPM

vue-slicezone

0.0.23
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 201
  • Score
    100M100P100Q88607F
  • License ISC

A component that maps other components to Prismic slices

Package Exports

  • vue-slicezone

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue-slicezone) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SliceZone

A component that matches front-end components with Prismic slices. Pretty much a work in progress, README coming soon.

Configuration

Depending on where you use the SliceZone, you may have to configure your app to transpile it from es6. Example with Nuxt config:

// in nuxt.config.js

build: {
  transpile: ['vue-slicezone']
}

Usage:

<template>
  <slice-zone :resolver="resolver" :slices="page.data.body" />
</template>
<script>
import SliceZone from 'vue-slicezone'

export default {
  components: {
    SliceZone
  },
  async asyncData({ params, $prismic }) {
    return {
        page: await $prismic.api.getByUID('page', params.uid)
      }
  },
  methods: {
    resolver({ sliceName }) {
      return [
        import(`path/to/slices/${sliceName}/index.vue`),
        import(`node/mo/dule/${sliceName}.vue`)
      ]
    }
  }
}
</script>