Slicemachine + Storybook + Nuxt-image

Hi all,

I am working on a project and just discovered nuxt-image which looks really compelling. I am using it currently in a slice via Slicemachine, and am having some trouble connecting it to Storybook to generate the screenshot.

Node: 14.16.0
Prismic CLI: 4.1.1

The image is set in Prismic in a slice, and is then using the <nuxt-img> component to render the image in different sizes, formats, etc.

The front-end works beautifully, however in Storybook, it seems to not pickup any of the url structure, and receives a broken image url. This does mean that for Slicemachine, the screenshot doesn't work as the image doesn't show up. The slice image path it generates is different from the one Storybook is receiving, so that could be the main issue.



Here's what the slice looks like, it's pretty barebones:

<section class="banner-image">
        <div class="banner-image-container">
                sizes="sm:200px, md:50px, lg:100vw, xl:100vw, xxl: 100vw"
            <!-- <prismic-image :field="slice.primary.image" /> -->

I'm not sure if anyone has been able to get nuxt-image to work with Storybook yet, as browsing the Github issues, I haven't been able to find anything.

Any assistance is greatly appreciated!


Hi Kolby,

Good to see you.

This is due to Slice Machine generating mock images from Unsplash. The Nuxt Image Prismic plugin expects images to be served through our image CDN ( So this leads to errors within Storybook.

To "patch" that you can provide an additional config to Prismic config on Nuxt image: baseURL and set it to Unsplash's one:

image: {
  prismic: {
    baseURL: ""

However you cannot have a consistent fix that will work for both.

The plan for the future to work better with systems like nuxt-image, is to serve Slice Machine mocks images through Prismic official image CDN.


Thanks so much for your response!

That makes total sense now. I look forward to the future improvements!

Thanks Phil!

1 Like

Threads close after a period of inactivity. Flag this thread to re-open it and continue the conversation.