preview.ejs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title><%= htmlWebpackPlugin.options.title || 'Storybook'%></title>
  6. <% if (htmlWebpackPlugin.files.favicon) { %>
  7. <link rel="shortcut icon" href="<%= htmlWebpackPlugin.files.favicon%>" />
  8. <% } %>
  9. <meta name="viewport" content="width=device-width, initial-scale=1" />
  10. <link rel="prefetch" href="./sb-common-assets/nunito-sans-regular.woff2" as="font" type="font/woff2" crossorigin />
  11. <link rel="prefetch" href="./sb-common-assets/nunito-sans-italic.woff2" as="font" type="font/woff2" crossorigin />
  12. <link rel="prefetch" href="./sb-common-assets/nunito-sans-bold.woff2" as="font" type="font/woff2" crossorigin />
  13. <link rel="prefetch" href="./sb-common-assets/nunito-sans-bold-italic.woff2" as="font" type="font/woff2" crossorigin />
  14. <link rel="stylesheet" href="./sb-common-assets/fonts.css" />
  15. <% if (typeof headHtmlSnippet !== 'undefined') { %> <%= headHtmlSnippet %> <% } %> <%
  16. htmlWebpackPlugin.files.css.forEach(file => { %>
  17. <link href="<%= file %>" rel="stylesheet" />
  18. <% }); %>
  19. <style>
  20. #storybook-root[hidden],
  21. #storybook-docs[hidden] {
  22. display: none !important;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <% if (typeof bodyHtmlSnippet !== 'undefined') { %> <%= bodyHtmlSnippet %> <% } %>
  28. <div id="storybook-root"></div>
  29. <div id="storybook-docs"></div>
  30. <% if (typeof globals !== 'undefined' && Object.keys(globals).length) { %>
  31. <script>
  32. <% for (var varName in globals) { %>
  33. <% if (globals[varName] != undefined) { %>
  34. window['<%=varName%>'] = <%= JSON.stringify(globals[varName]) %>;
  35. <% } %>
  36. <% } %>
  37. </script>
  38. <% } %>
  39. <script type="module">
  40. import './sb-preview/runtime.js';
  41. <% htmlWebpackPlugin.files.js.forEach(file => { %>
  42. import './<%= file %>';
  43. <% }); %>
  44. </script>
  45. </body>
  46. </html>