Skip to content

feat: integrate @rsbuild-image/rspress into website #2156

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Asuka109
Copy link
Contributor

@Asuka109 Asuka109 commented May 14, 2025

Summary

I'm working on the Rsbuild Image and which is a rsbuild plugin can bring image compiling and rendering optimizations into any Rsbuild-based applications.

And here is its rspress plugin, I integrated it into our website. Which provides lots of optimization approaches and some of them heavily relay on the compile-time analyzing. Since it perfer to store all of our image assets to the bytedance owned CDN or the https://github.com/rspack-contrib/rstack-design-resources repo (to reduce the file scaling of rspress repo?). I have to install the rstack-design-resources repo as a npm package to make all the assets resolvable.

Plugin Integration

  • Added the @rsbuild-image/rspress plugin configuration to rspress.config.ts files in both the e2e/fixtures/rsbuild-image and packages/document directories to enable image processing with IPX.

Documentation Updates

  • Updated architecture diagrams in both English and Chinese documentation to use new image URLs (css-extract-loader.png). Which is only used for demostration. You can visit and compare the differences between and to check the image optimizations.

End-to-End Testing

  • Added a new end-to-end test file plugin-image.test.ts to validate the functionality of the image plugin, including rendering and responsive behavior of images.

Fixture Setup for Testing

  • Created a new fixture directory e2e/fixtures/rsbuild-image with configuration files (package.json, rspress.config.ts, index.mdx, tsconfig.json) to support plugin testing.

Configuration Enhancements

  • Added a new path alias @assets/* in the tsconfig.json file for the packages/document directory to streamline asset imports.
  • Updated .vscode/settings.json to exclude the .rslib directory from search and indexing.

Related Issue

Checklist

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

Copy link

netlify bot commented May 14, 2025

Deploy Preview for rspress-v2 failed. Why did it fail? →

Name Link
🔨 Latest commit a536f04
🔍 Latest deploy log https://app.netlify.com/sites/rspress-v2/deploys/682433618ad77f000892ec70

Copy link

netlify bot commented May 14, 2025

Deploy Preview for rspress failed. Why did it fail? →

Name Link
🔨 Latest commit a536f04
🔍 Latest deploy log https://app.netlify.com/sites/rspress/deploys/68243361a3bc870008ce04b9

@@ -4,7 +4,7 @@ The plugin system is a crucial part of Rspress, which allows you to easily exten

The overall architecture of Rspress is shown in the figure below:

![Rspress Architecture](https://lf3-static.bytednsdoc.com/obj/eden-cn/uhbfnupenuhf/edenx-doc/arch-en.png)
![Rspress Architecture](https://assets.rspack.dev/rsdoctor/css-extract-loader.png)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this intented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I imported the image file as a asset module right on the zh translation. So that we can compare the different of their behaviours.
I updated the PR summary. You can see more context there.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The image is intented to be Rspress Architecture, but the new one css-extract-loader is definitely not.

"@rsbuild/plugin-sass": "~1.3.1",
"@rspress/plugin-algolia": "workspace:*",
"@rspress/plugin-llms": "workspace:*",
"@rspress/plugin-shiki": "workspace:*",
"@rstack-dev/doc-ui": "1.8.0",
"@rstack/resource": "git://github.com/rspack-contrib/rstack-design-resources.git",
Copy link
Collaborator

@JounQin JounQin May 14, 2025

Choose a reason for hiding this comment

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

At least it should be https:// protocol. And it's strange to install the whole repo although we're only relying on several resources inside.

Suggested change
"@rstack/resource": "git://github.com/rspack-contrib/rstack-design-resources.git",
"@rstack/resource": "rspack-contrib/rstack-design-resources",


export default defineConfig({
root: path.join(__dirname, 'doc'),
plugins: [pluginImage({ ipx: {} })],
Copy link
Member

Choose a reason for hiding this comment

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

{} is confused to users,

could this option be set to pluginImage({ ipx: true })?

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.

3 participants