-
Notifications
You must be signed in to change notification settings - Fork 4
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
Implementing SSR support for astro-rename #4
Comments
Hi, Sorry, I missed this issue. The main issue in SSR is process the file on the fly to transform his classes and keep the state of the transformed classes map. I think that Astro should be have a hook to implement this but I didn't have time to explore it. Any help would be welcome. In addition, I found this utiltiy that implement SSR transform for Next.JS but only for Tailwind CSS https://github.com/sonofmagic/tailwindcss-mangle. But maybe it would be interested to take a look of how Sonofmagic implemented it. |
Hey there, Astro released in 3.5.0 the ability to use Middlewares in an integration : It should now be possible to replace classes names using a middleware like it is shown in the doc here : https://docs.astro.build/en/guides/middleware/#example-redacting-sensitive-information It will probably be slow but as most of content website have cache, I guess it's ok for now ? |
Maybe can be implemented with a middlewares but I think it more interesting investigate the use the hook "astro:build:ssr". With it you can perform the replacement directly after the generation. Right now I am working on the v2 of this plugin that will be bring more stability and a safety replacements of the classes. After that I will take this issue, I will investigate also your suggestion. Thanks! |
hi, @jkhaui @Tanguy-Magnaudet you can test the early support to SSR in v2 alpha-6 version of the package => https://www.npmjs.com/package/astro-rename/v/2.0.0-alpha6 |
Very nice, great work! 👏 Sorry I never got a chance to try implement it myself |
Hey,
I came across this plugin from google/postcss-rename#43, funnily enough I had the exact same idea so it was nice seeing the great work you've already done to build this integration.
I'm just wondering if you can provide a high-level description of what the main blocker is atm for supporting SSR? That way, I can hopefully contribute to its implementation if I have time and it's not too complex. From a brief glance at the source maybe we'd need to hook into Astro's
build:ssr
step. Thanks!The text was updated successfully, but these errors were encountered: