这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@AlexanderZeilmann
Copy link
Contributor

This allows the minification of blog posts.

@vercel
Copy link

vercel bot commented Jan 11, 2022

Someone is attempting to deploy a commit to a Personal Account owned by @timlrx on Vercel.

@timlrx first needs to authorize it.

@timlrx
Copy link
Owner

timlrx commented Jan 12, 2022

There's no need for the plugin as both esbuild which is used by mdx-bundler and webpack / swc from nextjs will take care of it. It's intended for use in standalone applications.

@AlexanderZeilmann
Copy link
Contributor Author

Adding the plugin does have an effect (-> right-click -> view source):

esbuild / webpack / swc do minify the page but not the blog post.
It would probably make more sense to configure these build tools such that the blog post (and e.g. the json starting in line 2) is also minified. However, I haven't looked into the build setup too closely to fix this.

@timlrx
Copy link
Owner

timlrx commented Jan 12, 2022

Thanks, good to know. Can we try turning on the minify option in esbuild? Mdx-bundler has an example over here. Would prefer this approach over a rehype plugin if this works.

@vercel
Copy link

vercel bot commented Jan 12, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/timlrx/tailwind-nextjs-starter-blog/4Qnsz6iaE9KVCatzMFA3BATnHp38
✅ Preview: https://tailwind-nextjs-starter-blog-git-fork-alexanderze-7aadc9-timlrx.vercel.app

@AlexanderZeilmann
Copy link
Contributor Author

I'm not seeing any minification when using options.minify = true in the esbuildOptions.

@timlrx
Copy link
Owner

timlrx commented Jan 15, 2022

Took a deeper look into this issue. Mdx-bundler sets minify to true by default. Changing it to false does show a difference.

The output from xdm is probably treated by esbuild as a string literal and it does not minify it. Hence the plugin is required, if we truly want to minimize the size of HTML over the wire. It seems to be relatively minor about 6% smaller and am not too sure how much longer it takes to process but happy to merge in the change. Thanks!

@timlrx timlrx merged commit 9620c25 into timlrx:master Jan 15, 2022
Meez25 pushed a commit to Meez25/Blog that referenced this pull request Jun 17, 2024
bhiwagade-rahul pushed a commit to bhiwagade-rahul/tailwind-nextjs-starter-blog that referenced this pull request Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants