Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHANGE index.html.ejs to use files over chunks && UPGRADE generate-page-webpack-plugin #4134

Merged
merged 1 commit into from
Sep 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"ejs": "^2.6.1",
"express": "^4.16.3",
"find-cache-dir": "^2.0.0",
"generate-page-webpack-plugin": "^1.0.0",
"generate-page-webpack-plugin": "^1.1.0",
"global": "^4.3.2",
"json5": "^2.0.1",
"prop-types": "^15.6.2",
Expand Down
2 changes: 1 addition & 1 deletion lib/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"express": "^4.16.3",
"file-loader": "^2.0.0",
"find-cache-dir": "^2.0.0",
"generate-page-webpack-plugin": "^1.0.0",
"generate-page-webpack-plugin": "^1.1.0",
"global": "^4.3.2",
"interpret": "^1.1.0",
"json5": "^2.0.1",
Expand Down
22 changes: 14 additions & 8 deletions lib/core/src/server/templates/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@
<title>Storybook</title>
<link rel="shortcut icon" href="favicon.ico?v=1" />

<% if (options.headHtmlSnippet) { %>
<%- options.headHtmlSnippet %>
<% } %>

<% if (options.links) { %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there still a point on having options.links when we don't (well, can't) use them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well not really no. we do not expose a way to set this.

<% for (item of options.links) { %>
<% if (typeof item === 'string' || item instanceof String) { item = { href: item, rel: 'stylesheet' } } %>
<link<% for (key in item) { %> <%= key %>="<%= item[key] %>"<% } %>>
<% } %>
<% } %>

<% if (options.headHtmlSnippet) { %>
<%- options.headHtmlSnippet %>

<% for (item of files) { %>
<% if (item.match(/.css$/)) { %>
<link href="<%- item %>" rel="stylesheet" />
<% } %>
<% } %>

</head>
<body>

Expand Down Expand Up @@ -45,10 +51,10 @@
<% for (key in dlls) { %>
<script src="<%= compilation.outputOptions.publicPath %><%= dlls[key] %>" defer></script>
<% } %>
<% for (index in chunks) { %>
<% for (key in chunks[index].files) { %>
<script src="<%= compilation.outputOptions.publicPath %><%= chunks[index].files[key] %>" defer></script>

<% for (item of files) { %>
<% if (item.match(/.js$/)) { %>
<script src="<%- item %>" defer></script>
<% } %>
<% } %>

Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7796,9 +7796,9 @@ gaze@^1.0.0:
dependencies:
globule "^1.0.0"

generate-page-webpack-plugin@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/generate-page-webpack-plugin/-/generate-page-webpack-plugin-1.0.0.tgz#e6261efb7e6b9ef8a8136126b14fa26aedfb7f33"
generate-page-webpack-plugin@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/generate-page-webpack-plugin/-/generate-page-webpack-plugin-1.1.0.tgz#5940c9c6bdbfa03b1a4ef8f909875d5ebafbd3af"

genfun@^4.0.1:
version "4.0.1"
Expand Down