reg-viz / storycap

A Storybook Addon, Save the screenshot image of your stories :camera: via puppeteer.
https://www.npmjs.com/package/storycap
MIT License
714 stars 89 forks source link

Pug templates seem to not be supported #86

Open sneko opened 6 years ago

sneko commented 6 years ago

Hi!

When I run the plugin on my Vue.js components, it fails when parsing the template:

ERROR in ./src/views/Home.vue?vue&type=template&id=fae5bece&lang=pug& (./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./src/views/Home.vue?vue&type=template&id=fae5bece&lang=pug&)
Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):
(Emitted value instead of an instance of Error)
  Error compiling template:

  .onboarding.background-blue
    .wrapper(padding='')
         // Removed the rest to keep the sample clean

  - Component template requires a root element, rather than just text.

 @ ./src/views/Home.vue?vue&type=template&id=fae5bece&lang=pug& 1:0-211 1:0-211
 @ ./src/views/Home.vue
 @ ./src/stories/index.stories.js
 @ ./src/stories sync .stories.js$
 @ ./config/storybook/config.js
 @ multi ./node_modules/@storybook/core/dist/server/config/polyfills.js ./node_modules/@storybook/core/dist/server/config/globals.js ./config/storybook/config.js ./node_modules/webpack-hot-middleware/client.js?reload=true

Do you know what's missing to take in account Pug loader? I don't understand why it doesn't work because when I run Storybook on its own it works well...

Thank you,

theKashey commented 6 years ago

This issue is related to storybook, not to storybook-chrome-screenshot which just runs it.

sneko commented 6 years ago

@theKashey, are you sure? My components are well displayed in Storybook :/

theKashey commented 6 years ago

Absolutely. This library just runs storybook and next open it in headless browser. Nothing more.

sneko commented 6 years ago

@theKashey thank you for the information. I don't understand why there is a difference between reaching directly Storybook and by storybook-chrome-screenshot 😢