nuxt-modules / prismic

Easily connect your Nuxt.js application to your content hosted on Prismic

Home Page:https://prismic.nuxtjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to Disable Prismic Toolbar and Preview

jeffhunt00 opened this issue · comments

I don't really need to use the Preview feature on the small 1-page I'm building. I also really don't care to use Prismic's Toolbar feature for in-site editing.

It would be great to be able to fully disable these features, such that the associated javascript is not included/downloaded when visitors hit the page. If I hit my page in private browser tab (ie: not signed into Prismic), it seems to download quite a bit of JS that is not required to simply display my content, including jQuery 2.1.1.

I've tried disabling preview in nuxt.config.js, but it doesn't seem to have any effect:

modules: [
['prismic-nuxt', {
endpoint: 'https://XXX.cdn.prismic.io/api/v2',
preview: false,
components: false,
deferLoad: true,
linkResolver: function(doc, ctx) {
return '/'
}
}]
]

Hi @jeffhunt00

This will be fixed with the v1

V1 is out :)

Sorry to reopen this but how does one disable the toolbar? I have preview: false in nuxt.config.js but the toolbar is still being rendered

How's going now? What's the solution here?

commented

Hi @zjhiphop, if you want to disable Prismic Toolbar and Preview provided by this module you should be able to do so by specifying preview: false in your module options, script won't be injected. Let me know how it goes!

In Nuxt 3, using "@nuxtjs/prismic": "^3.1.0",

You can do the following in nuxt.config.ts

  prismic: {
    endpoint: prismicRepoEndpoint,
    preview: false,
    toolbar: false,
  },