template.ejs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title><%= typeof title !== 'undefined'? title : 'Storybook'%></title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1" />
  7. <% if (favicon.endsWith('.svg')) {%>
  8. <link rel="icon" type="image/svg+xml" href="./<%= favicon %>" />
  9. <% } else if (favicon.endsWith('.ico')) { %>
  10. <link rel="icon" type="image/x-icon" href="./<%= favicon %>" />
  11. <% } %>
  12. <link
  13. rel="prefetch"
  14. href="./sb-common-assets/nunito-sans-regular.woff2"
  15. as="font"
  16. type="font/woff2"
  17. crossorigin
  18. />
  19. <link
  20. rel="prefetch"
  21. href="./sb-common-assets/nunito-sans-bold.woff2"
  22. as="font"
  23. type="font/woff2"
  24. crossorigin
  25. />
  26. <link rel="stylesheet" href="./sb-common-assets/fonts.css" />
  27. <link href="./sb-manager/runtime.js" rel="modulepreload" />
  28. <% files.js.forEach(file => { %>
  29. <link href="<%= file %>" rel="modulepreload" />
  30. <% }); %> <% if (typeof head !== 'undefined') { %> <%- head %> <% } %>
  31. <style>
  32. #storybook-root[hidden] {
  33. display: none !important;
  34. }
  35. </style>
  36. <% files.css.forEach(file => { %>
  37. <link href="<%= file %>" rel="stylesheet" />
  38. <% }); %>
  39. </head>
  40. <body>
  41. <div id="root"></div>
  42. <% if (typeof globals !== 'undefined' && Object.keys(globals).length) { %>
  43. <script>
  44. <% for (var varName in globals) { %>
  45. <% if (globals[varName] !== undefined) { %>
  46. window['<%=varName%>'] = <%- (globals[varName]) %>;
  47. <% } %>
  48. <% } %>
  49. </script>
  50. <% } %>
  51. <script type="module">
  52. import './sb-manager/runtime.js';
  53. <% files.js.forEach(file => { %>
  54. import '<%= file %>';
  55. <% }); %>
  56. </script>
  57. <link href="./sb-preview/runtime.js" rel="prefetch" as="script" />
  58. </body>
  59. </html>