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

refactor: use the title option in the html template, instead of hard-code the project name #5060

Merged
merged 1 commit into from Jan 13, 2020

Conversation

sodatea
Copy link
Member

@sodatea sodatea commented Jan 9, 2020

closes #5056

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information:

</head>
<body>
<noscript>
<strong>We're sorry but <%= rootOptions.projectName %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
<strong>We're sorry but <%%= htmlWebpackPlugin.options.title %%> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we use projectName from vue.config.js?

Copy link
Member Author

Choose a reason for hiding this comment

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

rootOptions.projectName is inferred from package.json so it's equivalent to the default title option value set below.

This PR is to make the title element in the template dynamic, so that users can change the page title by configuring html-webpack-plugin. Most common use cases may be in multi-page apps.

I originally thought the title option would be injected into the page by default, like meta tags. But it turns out that users need to place an interpolation expression in the template manually. jantimon/html-webpack-plugin#1302 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

在vue.config.js中使用chainWebpack修改配置title没有生效
2 participants