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

feat(html): improve template parameters #7686

Merged
merged 7 commits into from
Aug 28, 2024

Conversation

LingyuCoder
Copy link
Contributor

@LingyuCoder LingyuCoder commented Aug 26, 2024

Summary

Support more templateParameters

htmlRspackPlugin.tags

  • Can be used to inject tags at any place of the template with <%= toHtml(htmlRspackPlugin.tags.headTags) %>
    • Need to call toHtml function because in HtmlWebpackPlugin, javascript can override the toString() method but this can not be done in dojang.
  • Can be used to walk tags with <% for tag in htmlRspackPlugin.tags.headTags { %> and <% if tag.tagName=="script" { %> to filter the tags
    • Does not support javascript syntax because these statements are running in dojang
    • Can also call toHtml on a single tag to generate its html

htmlRspackPlugin.files

  • favicon: can be used to inject the full favicon uri with htmlRspackPlugin.files.favicon if provided in options of HtmlRspackPlugin
  • publicPath: can be used to inejct the public path with htmlRspackPlugin.files.publicPath which calculated from output.publicPath
  • scripts: can be used to get all .js assets with htmlRspackPlugin.files.js
  • styles: can be used to get all .css assets with htmlRspackPlugin.files.css

htmlRspackPlugin.options

The options of HtmlRspackPlugin except templateParameters which can be get directly with <%= key %>

rspackConfig

Only support widely used mode, output.publicPath and output.crossOriginLoading

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added the release: feature release: feature related release(mr only) label Aug 26, 2024
Copy link

netlify bot commented Aug 26, 2024

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 27d561c
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/66ced9a0cb40ae0008553b0b

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Aug 26, 2024
@LingyuCoder LingyuCoder marked this pull request as ready for review August 28, 2024 08:19
@LingyuCoder LingyuCoder requested a review from ahabhgk August 28, 2024 08:20
@LingyuCoder LingyuCoder merged commit f976715 into main Aug 28, 2024
31 checks passed
@LingyuCoder LingyuCoder deleted the feat/improve-template-parameters branch August 28, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants