How to use the @storybook/core/dist/server/utils.getPreviewBodyHtml function in @storybook/core

To help you get started, we’ve selected a few @storybook/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FirefoxUX / photon-components-web / .storybook / webpack.config.js View on Github external
module.exports = (baseConfig, env, defaultConfig) => {
  /*
    This is a giant hack to override the index template used in generating the HTML
    for Storybook from the default configuration:

    https://github.com/storybooks/storybook/blob/7eca652b3cc68afe0003776f41e635251f0b885d/lib/core/src/server/config/webpack.config.dev.js#L46
  */
  const entriesMeta = {
    iframe: {
      headHtmlSnippet: getPreviewHeadHtml(__dirname, process.env),
      bodyHtmlSnippet: getPreviewBodyHtml(),
    },
    manager: {
      headHtmlSnippet: getManagerHeadHtml(__dirname, process.env),
    },
  };
  const entries = defaultConfig.entry;
  const plugins = [
    ...Object.keys(entries).map(
      e =>
        new HtmlWebpackPlugin({
          filename: `${e === 'manager' ? 'index' : e}.html`,
          excludeChunks: Object.keys(entries).filter(i => i !== e),
          chunksSortMode: 'none',
          alwaysWriteToDisk: true,
          inject: false,
          templateParameters: (compilation, files, options) => ({