Replies: 2 comments 2 replies
-
Note: I'm also not sure how to handle For example, it errors for React code such as I'm not sure we should throw and block the SSG process just because of that. I'm not sure either it's a good idea to swallow those errors. |
Beta Was this translation helpful? Give feedback.
-
Great! I'm really glad to see it used.
No, I didn't.
I'll add documentation about it tomorrow. While working on it I will add some tests to ensure that it can be used for react SSG frameworks. Thank you so much for interest! @alexander-akait did wonderful work for it. |
Beta Was this translation helpful? Give feedback.
-
Hi
I'm in the process of adding
@swc/html
to Docusaurus and really getting great results so far 👏:PR facebook/docusaurus#10554
It turns out the most popular Node option is probably terser/html-minifier-terser but it's a real bottleneck for our SSG framework, and
@swc/html
gives a significant perf boost. I think it deserves more attention from the community.Unrelated but curious: have you benchmarked it against
@minify-html/node
?Unfortunately, the Node.js package is not really documented, or at least I couldn't find it
https://github.com/swc-project/swc/tree/main/packages/html
I saw this other discussion from 2022: #6278
I've figured out how to use it through types, reading Options comments found in Rust crates and in Webpack plugin code:
I was wondering if you plan to document it and/or if you need any help.
That would be a shame if the community missed this great package due to a lack of basic docs and little DX polishment, in particular SSG frameworks.
Considering the current npm downloads, I'll probably be the first to use it on something concrete.
Note I've opened a PR with a few TS suggested type changes: #9615
I also think it could improve the DX if we could pass an HTML string as 1st param and not just a buffer.
That could also be useful to explain it how to use it in a React context, because some options could mess up with React hydration. BTW do you have recommendations on that?
So far I'm using the following options:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions